@@ -9,7 +9,6 @@ import (
99 oidc "github.com/coreos/go-oidc"
1010 ipapi "github.com/oauth2-proxy/oauth2-proxy/pkg/apis/ip"
1111 sessionsapi "github.com/oauth2-proxy/oauth2-proxy/pkg/apis/sessions"
12− "github.com/oauth2-proxy/oauth2-proxy/pkg/logger"
1312 "github.com/oauth2-proxy/oauth2-proxy/providers"
1413 "github.com/spf13/pflag"
1514)
@@ -61,6 +60,7 @@ type Options struct {
6160
6261 Cookie CookieOptions `cfg:",squash"`
6362 Session SessionOptions `cfg:",squash"`
63+ Logging Logging `cfg:",squash"`
6464
6565 Upstreams []string `flag:"upstream" cfg:"upstreams"`
6666 SkipAuthRegex []string `flag:"skip-auth-regex" cfg:"skip_auth_regex"`
@@ -101,27 +101,12 @@ type Options struct {
101101 ApprovalPrompt string `flag:"approval-prompt" cfg:"approval_prompt"` // Deprecated by OIDC 1.0
102102 UserIDClaim string `flag:"user-id-claim" cfg:"user_id_claim"`
103103
104− // Configuration values for logging
105− LoggingFilename string `flag:"logging-filename" cfg:"logging_filename"`
106− LoggingMaxSize int `flag:"logging-max-size" cfg:"logging_max_size"`
107− LoggingMaxAge int `flag:"logging-max-age" cfg:"logging_max_age"`
108− LoggingMaxBackups int `flag:"logging-max-backups" cfg:"logging_max_backups"`
109− LoggingLocalTime bool `flag:"logging-local-time" cfg:"logging_local_time"`
110− LoggingCompress bool `flag:"logging-compress" cfg:"logging_compress"`
111− StandardLogging bool `flag:"standard-logging" cfg:"standard_logging"`
112− StandardLoggingFormat string `flag:"standard-logging-format" cfg:"standard_logging_format"`
113− RequestLogging bool `flag:"request-logging" cfg:"request_logging"`
114− RequestLoggingFormat string `flag:"request-logging-format" cfg:"request_logging_format"`
115− ExcludeLoggingPaths string `flag:"exclude-logging-paths" cfg:"exclude_logging_paths"`
116− SilencePingLogging bool `flag:"silence-ping-logging" cfg:"silence_ping_logging"`
117− AuthLogging bool `flag:"auth-logging" cfg:"auth_logging"`
118− AuthLoggingFormat string `flag:"auth-logging-format" cfg:"auth_logging_format"`
119− SignatureKey string `flag:"signature-key" cfg:"signature_key"`
120− AcrValues string `flag:"acr-values" cfg:"acr_values"`
121− JWTKey string `flag:"jwt-key" cfg:"jwt_key"`
122− JWTKeyFile string `flag:"jwt-key-file" cfg:"jwt_key_file"`
123− PubJWKURL string `flag:"pubjwk-url" cfg:"pubjwk_url"`
124− GCPHealthChecks bool `flag:"gcp-healthchecks" cfg:"gcp_healthchecks"`
104+ SignatureKey string `flag:"signature-key" cfg:"signature_key"`
105+ AcrValues string `flag:"acr-values" cfg:"acr_values"`
106+ JWTKey string `flag:"jwt-key" cfg:"jwt_key"`
107+ JWTKeyFile string `flag:"jwt-key-file" cfg:"jwt_key_file"`
108+ PubJWKURL string `flag:"pubjwk-url" cfg:"pubjwk_url"`
109+ GCPHealthChecks bool `flag:"gcp-healthchecks" cfg:"gcp_healthchecks"`
125110
126111 // internal values that are set after config validation
127112 redirectURL *url.URL
@@ -197,20 +182,7 @@ func NewOptions() *Options {
197182 UserIDClaim: "email",
198183 InsecureOIDCAllowUnverifiedEmail: false,
199184 SkipOIDCDiscovery: false,
200− LoggingFilename: "",
201− LoggingMaxSize: 100,
202− LoggingMaxAge: 7,
203− LoggingMaxBackups: 0,
204− LoggingLocalTime: true,
205− LoggingCompress: false,
206− ExcludeLoggingPaths: "",
207− SilencePingLogging: false,
208− StandardLogging: true,
209− StandardLoggingFormat: logger.DefaultStandardLoggingFormat,
210− RequestLogging: true,
211− RequestLoggingFormat: logger.DefaultRequestLoggingFormat,
212− AuthLogging: true,
213− AuthLoggingFormat: logger.DefaultAuthLoggingFormat,
185+ Logging: loggingDefaults(),
214186 }
215187}
216188
@@ -293,24 +265,6 @@ func NewFlagSet() *pflag.FlagSet {
293265 flagSet.Bool("redis-use-cluster", false, "Connect to redis cluster. Must set --redis-cluster-connection-urls to use this feature")
294266 flagSet.StringSlice("redis-cluster-connection-urls", []string{}, "List of Redis cluster connection URLs (eg redis://HOST[:PORT]). Used in conjunction with --redis-use-cluster")
295267
296− flagSet.String("logging-filename", "", "File to log requests to, empty for stdout")
297− flagSet.Int("logging-max-size", 100, "Maximum size in megabytes of the log file before rotation")
298− flagSet.Int("logging-max-age", 7, "Maximum number of days to retain old log files")
299− flagSet.Int("logging-max-backups", 0, "Maximum number of old log files to retain; 0 to disable")
300− flagSet.Bool("logging-local-time", true, "If the time in log files and backup filenames are local or UTC time")
301− flagSet.Bool("logging-compress", false, "Should rotated log files be compressed using gzip")
302−
303− flagSet.Bool("standard-logging", true, "Log standard runtime information")
304− flagSet.String("standard-logging-format", logger.DefaultStandardLoggingFormat, "Template for standard log lines")
305−
306− flagSet.Bool("request-logging", true, "Log HTTP requests")
307− flagSet.String("request-logging-format", logger.DefaultRequestLoggingFormat, "Template for HTTP request log lines")
308− flagSet.String("exclude-logging-paths", "", "Exclude logging requests to paths (eg: '/path1,/path2,/path3')")
309− flagSet.Bool("silence-ping-logging", false, "Disable logging of requests to ping endpoint")
310−
311− flagSet.Bool("auth-logging", true, "Log authentication attempts")
312− flagSet.String("auth-logging-format", logger.DefaultAuthLoggingFormat, "Template for authentication log lines")
313−
314268 flagSet.String("provider", "google", "OAuth provider")
315269 flagSet.String("provider-display-name", "", "Provider display name")
316270 flagSet.String("oidc-issuer-url", "", "OpenID Connect issuer URL (ie: https://accounts.google.com)")
@@ -336,5 +290,7 @@ func NewFlagSet() *pflag.FlagSet {
336290
337291 flagSet.String("user-id-claim", "email", "which claim contains the user ID")
338292
293+ flagSet.AddFlagSet(loggingFlagSet())
294+
339295 return flagSet
340296}