From 91f461283ec25dd43d55db97f981723a94f208b8 Mon Sep 17 00:00:00 2001 From: deads2k Date: Fri, 17 Mar 2017 14:43:15 -0400 Subject: [PATCH] use - to indicate audit log goes to system out --- staging/src/k8s.io/apiserver/pkg/server/options/audit.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apiserver/pkg/server/options/audit.go b/staging/src/k8s.io/apiserver/pkg/server/options/audit.go index 2bb7f2cf76..341f87ee86 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/options/audit.go +++ b/staging/src/k8s.io/apiserver/pkg/server/options/audit.go @@ -17,6 +17,8 @@ limitations under the License. package options import ( + "os" + "github.com/spf13/pflag" "gopkg.in/natefinch/lumberjack.v2" @@ -36,7 +38,7 @@ func NewAuditLogOptions() *AuditLogOptions { func (o *AuditLogOptions) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&o.Path, "audit-log-path", o.Path, - "If set, all requests coming to the apiserver will be logged to this file.") + "If set, all requests coming to the apiserver will be logged to this file. '-' means standard out.") fs.IntVar(&o.MaxAge, "audit-log-maxage", o.MaxBackups, "The maximum number of days to retain old audit log files based on the timestamp encoded in their filename.") fs.IntVar(&o.MaxBackups, "audit-log-maxbackup", o.MaxBackups, @@ -50,6 +52,11 @@ func (o *AuditLogOptions) ApplyTo(c *server.Config) error { return nil } + if o.Path == "-" { + c.AuditWriter = os.Stdout + return nil + } + c.AuditWriter = &lumberjack.Logger{ Filename: o.Path, MaxAge: o.MaxAge,