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.
This commit is contained in:
Euan Kemp
2016-05-18 15:00:56 -07:00
parent c1c0567e37
commit d0a31873d7

View File

@@ -118,7 +118,9 @@ func (r *Runtime) GetContainerLogs(pod *api.Pod, containerID kubecontainer.Conta
return err 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. // Get the json structured logs.
cmd.Args = append(cmd.Args, "-o", "json") cmd.Args = append(cmd.Args, "-o", "json")