summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-11-01 17:43:50 -0700
committerShentubot <shentubot@google.com>2018-11-01 17:44:58 -0700
commitb6b81fd04ba93db3268ff649c9d23a25c9b89db5 (patch)
tree730c112ed3d8aed5696466672f5c3a2eb16cb9a7 /runsc/boot
parent9d69d85bc13d4f0956a39951b5cd6777f938cffd (diff)
Add new log format that is compatible with Kubernetes
Fluentd configuration uses 'log' for the log message while containerd uses 'msg'. Since we can't have a single JSON format for both, add another log format and make debug log configurable. PiperOrigin-RevId: 219729658 Change-Id: I2a6afc4034d893ab90bafc63b394c4fb62b2a7a0
Diffstat (limited to 'runsc/boot')
-rw-r--r--runsc/boot/compat.go2
-rw-r--r--runsc/boot/config.go6
2 files changed, 6 insertions, 2 deletions
diff --git a/runsc/boot/compat.go b/runsc/boot/compat.go
index d18c2f802..4c49e90e3 100644
--- a/runsc/boot/compat.go
+++ b/runsc/boot/compat.go
@@ -66,7 +66,7 @@ func newCompatEmitter(logFD int) (*compatEmitter, error) {
if logFD > 0 {
f := os.NewFile(uintptr(logFD), "user log file")
- target := log.MultiEmitter{c.sink, log.GoogleEmitter{&log.Writer{Next: f}}}
+ target := log.MultiEmitter{c.sink, log.K8sJSONEmitter{log.Writer{Next: f}}}
c.sink = &log.BasicLogger{Level: log.Info, Emitter: target}
}
return c, nil
diff --git a/runsc/boot/config.go b/runsc/boot/config.go
index 9ebbde424..2d89ad87e 100644
--- a/runsc/boot/config.go
+++ b/runsc/boot/config.go
@@ -157,12 +157,15 @@ type Config struct {
// LogFilename is the filename to log to, if not empty.
LogFilename string
- // LogFormat is the log format, "text" or "json".
+ // LogFormat is the log format.
LogFormat string
// DebugLog is the path to log debug information to, if not empty.
DebugLog string
+ // DebugLogFormat is the log format for debug.
+ DebugLogFormat string
+
// FileAccess indicates how the filesystem is accessed.
FileAccess FileAccessType
@@ -214,6 +217,7 @@ func (c *Config) ToFlags() []string {
"--log=" + c.LogFilename,
"--log-format=" + c.LogFormat,
"--debug-log=" + c.DebugLog,
+ "--debug-log-format=" + c.DebugLogFormat,
"--file-access=" + c.FileAccess.String(),
"--overlay=" + strconv.FormatBool(c.Overlay),
"--network=" + c.Network.String(),