Allow control of HTTP logging
parent
e890468b48
commit
a3fbba33da
|
@ -179,6 +179,7 @@ type Config struct {
|
|||
Snapshot Snapshot `toml:"snapshot"`
|
||||
|
||||
Logging struct {
|
||||
HTTPAccess bool `toml:"http-access"`
|
||||
WriteTracing bool `toml:"write-tracing"`
|
||||
RaftTracing bool `toml:"raft-tracing"`
|
||||
} `toml:"logging"`
|
||||
|
@ -238,6 +239,10 @@ func NewConfig() *Config {
|
|||
c.Data.RetentionCheckPeriod = Duration(DefaultRetentionCheckPeriod)
|
||||
c.Data.RetentionCreatePeriod = Duration(DefaultRetentionCreatePeriod)
|
||||
|
||||
c.Logging.HTTPAccess = true
|
||||
c.Logging.WriteTracing = false
|
||||
c.Logging.RaftTracing = false
|
||||
|
||||
c.Monitoring.Enabled = false
|
||||
c.Monitoring.WriteInterval = Duration(DefaultStatisticsWriteInterval)
|
||||
c.ContinuousQuery.RecomputePreviousN = DefaultContinuousQueryRecomputePreviousN
|
||||
|
|
|
@ -104,6 +104,7 @@ func (h *Handler) serveData(w http.ResponseWriter, r *http.Request) {
|
|||
sh := httpd.NewClusterHandler(h.Server, h.Config.Authentication.Enabled,
|
||||
h.Config.Snapshot.Enabled, version)
|
||||
sh.WriteTrace = h.Config.Logging.WriteTracing
|
||||
sh.HTTPAccessLogging = h.Config.Logging.HTTPAccess
|
||||
sh.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1426,7 +1426,6 @@ func Test3NodeServerFailover(t *testing.T) {
|
|||
|
||||
// ensure that all queries work if there are more nodes in a cluster than the replication factor
|
||||
func Test3NodeClusterPartiallyReplicated(t *testing.T) {
|
||||
t.Skip("Skipping due to instability")
|
||||
testName := "3-node server integration partial replication"
|
||||
if testing.Short() {
|
||||
t.Skip(fmt.Sprintf("skipping '%s'", testName))
|
||||
|
|
|
@ -53,8 +53,9 @@ type Handler struct {
|
|||
snapshotEnabled bool
|
||||
version string
|
||||
|
||||
Logger *log.Logger
|
||||
WriteTrace bool // Detailed logging of write path
|
||||
Logger *log.Logger
|
||||
HTTPAccessLogging bool // Log every HTTP access.
|
||||
WriteTrace bool // Detailed logging of write path
|
||||
}
|
||||
|
||||
// NewClusterHandler is the http handler for cluster communication endpoints
|
||||
|
@ -169,7 +170,7 @@ func (h *Handler) SetRoutes(routes []route) {
|
|||
handler = versionHeader(handler, h.version)
|
||||
handler = cors(handler)
|
||||
handler = requestID(handler)
|
||||
if r.log {
|
||||
if h.HTTPAccessLogging && r.log {
|
||||
handler = logging(handler, r.name, h.Logger)
|
||||
}
|
||||
handler = recovery(handler, r.name, h.Logger) // make sure recovery is always last
|
||||
|
|
Loading…
Reference in New Issue