diff --git a/configuration/configuration.go b/configuration/configuration.go index 95fad34e..0f8c8bc2 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -22,6 +22,12 @@ type Configuration struct { // Log supports setting various parameters related to the logging // subsystem. Log struct { + // AccessLog configures access logging. + AccessLog struct { + // Disabled disables access logging. + Disabled bool `yaml:"disabled,omitempty"` + } `yaml:"accesslog,omitempty"` + // Level is the granularity at which registry operations are logged. Level Loglevel `yaml:"level"` diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index 1768894e..08c015ee 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -19,6 +19,9 @@ func Test(t *testing.T) { TestingT(t) } var configStruct = Configuration{ Version: "0.1", Log: struct { + AccessLog struct { + Disabled bool `yaml:"disabled,omitempty"` + } `yaml:"accesslog,omitempty"` Level Loglevel `yaml:"level"` Formatter string `yaml:"formatter,omitempty"` Fields map[string]interface{} `yaml:"fields,omitempty"` diff --git a/docs/configuration.md b/docs/configuration.md index 0689d8d2..53af5ed8 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -55,6 +55,8 @@ information about each option that appears later in this page. version: 0.1 log: + accesslog: + disabled: true level: debug formatter: text fields: @@ -280,6 +282,8 @@ system outputs everything to stdout. You can adjust the granularity and format with this configuration section. log: + accesslog: + disabled: true level: debug formatter: text fields: @@ -318,7 +322,7 @@ with this configuration section. logstash. The default is text. - + fields @@ -330,8 +334,19 @@ with this configuration section. the context. This is useful for identifying log messages source after being mixed in other systems. + +### accesslog + + accesslog: + disabled: true + +Within `log`, `accesslog` configures the behavior of the access logging +system. By default, the access logging system outputs to stdout in +[Combined Log Format](https://httpd.apache.org/docs/2.4/logs.html#combined). +Access logging can be disabled by setting the boolean flag `disabled` to `true`. + ## hooks hooks: diff --git a/registry/registry.go b/registry/registry.go index 2dd23aa7..2adcb1e3 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -91,7 +91,9 @@ func NewRegistry(ctx context.Context, config *configuration.Configuration) (*Reg handler = alive("/", handler) handler = health.Handler(handler) handler = panicHandler(handler) - handler = gorhandlers.CombinedLoggingHandler(os.Stdout, handler) + if !config.Log.AccessLog.Disabled { + handler = gorhandlers.CombinedLoggingHandler(os.Stdout, handler) + } server := &http.Server{ Handler: handler,