'How long are kubernetes logs stored?
If I run, for example, kubectl logs --namespace kube-system kube-apiserver-XXXX | head -n 25 I can see the output with only a timestamp and no date. I can't tell if these are from the inception of the pod or not.
Generally speaking, how long do a pod's logs last in Kubernetes?
Solution 1:[1]
Kubernetes performs log rotation daily, or if the log file grows beyond 10MB in size. Each rotation belongs to a single container; if the container repeatedly fails or the pod is evicted, all previous rotations for the container are lost. By default, Kubernetes keeps up to five logging rotations per container.
The container runtime attaches the current timestamp to every line produced by the application. You can display these timestamps by using the --timestamps=true option while running kubectl logs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ns94 |
