mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 21:53:52 +00:00
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:
@@ -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")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user