git.iko.soy/typeable/oauth2-proxy
on master help sign in
Ensure exclude-logging-paths is consistent with other options
commit94e31f8b65102f9ace88dfd47c06fe40ef468583 authorJoel Speed <joel.speed@hotmail.co.uk> dateSun 24 May 2020, 21:59 (6 years ago) parentf7c88f5
2 files changed+4−6
pkg/apis/options/logging.go+3−2 pkg/validation/logging.go+1−4
pkg/apis/options/logging.go+3−2
@@ -13,7 +13,7 @@ type Logging struct {
1313 RequestFormat string `flag:"request-logging-format" cfg:"request_logging_format"`
1414 StandardEnabled bool `flag:"standard-logging" cfg:"standard_logging"`
1515 StandardFormat string `flag:"standard-logging-format" cfg:"standard_logging_format"`
16− ExcludePaths string `flag:"exclude-logging-paths" cfg:"exclude_logging_paths"`
16+ ExcludePaths []string `flag:"exclude-logging-path" cfg:"exclude_logging_paths"`
1717 LocalTime bool `flag:"logging-local-time" cfg:"logging_local_time"`
1818 SilencePing bool `flag:"silence-ping-logging" cfg:"silence_ping_logging"`
1919 File LogFileOptions `cfg:",squash"`
@@ -38,7 +38,7 @@ func loggingFlagSet() *pflag.FlagSet {
3838 flagSet.Bool("request-logging", true, "Log HTTP requests")
3939 flagSet.String("request-logging-format", logger.DefaultRequestLoggingFormat, "Template for HTTP request log lines")
4040
41− flagSet.String("exclude-logging-paths", "", "Exclude logging requests to paths (eg: '/path1,/path2,/path3')")
41+ flagSet.StringSlice("exclude-logging-path", []string{}, "Exclude logging requests to paths (eg: '/path1,/path2,/path3')")
4242 flagSet.Bool("logging-local-time", true, "If the time in log files and backup filenames are local or UTC time")
4343 flagSet.Bool("silence-ping-logging", false, "Disable logging of requests to ping endpoint")
4444
@@ -54,6 +54,7 @@ func loggingFlagSet() *pflag.FlagSet {
5454// loggingDefaults creates a Logging structure, populating each field with its default value
5555func loggingDefaults() Logging {
5656 return Logging{
57+ ExcludePaths: nil,
5758 LocalTime: true,
5859 SilencePing: false,
5960 AuthEnabled: true,
pkg/validation/logging.go+1−4
@@ -2,7 +2,6 @@ package validation
22
33import (
44 "os"
5− "strings"
65
76 "github.com/oauth2-proxy/oauth2-proxy/pkg/apis/options"
87 "github.com/oauth2-proxy/oauth2-proxy/pkg/logger"
@@ -49,12 +48,10 @@ func configureLogger(o options.Logging, pingPath string, msgs []string) []string
4948 logger.SetAuthTemplate(o.AuthFormat)
5049 logger.SetReqTemplate(o.RequestFormat)
5150
52− excludePaths := make([]string, 0)
53− excludePaths = append(excludePaths, strings.Split(o.ExcludePaths, ",")...)
51+ excludePaths := o.ExcludePaths
5452 if o.SilencePing {
5553 excludePaths = append(excludePaths, pingPath)
5654 }
57−
5855 logger.SetExcludePaths(excludePaths)
5956
6057 if !o.LocalTime {