From d0a31873d7d218df3097d0efb0a87d80c0f334e1 Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Wed, 18 May 2016 15:00:56 -0700 Subject: [PATCH] rkt: Get logs via syslog identifier This change works around https://github.com/coreos/rkt/issues/2630 Without this change, logs cannot reliably be collected for containers with short lifetimes. With this change, logs cannot be collected on rkt versions v1.6.0 and before. --- pkg/kubelet/rkt/log.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/rkt/log.go b/pkg/kubelet/rkt/log.go index 738b4ea45a7..b4bffa0b46f 100644 --- a/pkg/kubelet/rkt/log.go +++ b/pkg/kubelet/rkt/log.go @@ -118,7 +118,9 @@ func (r *Runtime) GetContainerLogs(pod *api.Pod, containerID kubecontainer.Conta return err } - cmd := exec.Command("journalctl", "-m", fmt.Sprintf("_MACHINE_ID=%s", strings.Replace(id.uuid, "-", "", -1)), "-u", id.appName, "-a") + // Note: this only works for rkt versions after 1.6.0 + // See https://github.com/coreos/rkt/issues/2630 + cmd := exec.Command("journalctl", "-m", fmt.Sprintf("_MACHINE_ID=%s", strings.Replace(id.uuid, "-", "", -1)), "-t", id.appName, "-a") // Get the json structured logs. cmd.Args = append(cmd.Args, "-o", "json")