-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does Docker do log rotation? #36
Comments
You're correct, we don't have any application level log rotation on by default. We'll take this as a feature request |
Thanks @micahhausler. Is there a recommended path forward in the mean time? Should we connect to the EC2 instances and install logrotate for a particular path? |
Yes, you can update your logrotate configuration on boot, or build your own AMI |
The logrotate linked (non-expiring link here) does not rotate container logs: it rotates logs for various other k8s services. Docker itself needs to be configured to rotate logs as per this support article. Which can be seen here in the GCE kube-up.sh script. |
We get some pods evicted due to disk pressure. Could this be why? Should I make a PR to add something similar to the configuration from @dpiddockcmp link to |
This is exactly what happened to us too. The Engine is installed with vanilla configuration, so there was no container log rotation (which can be set with log-opts) and it filled the disk. It also doesn't pick up /etc/docker/daemon.json automatically, so having to update the service definition to feed in "--config-file=/etc/docker/daemon.json". |
After looking into this issue, I don't think there is an optimal solution at the instance level. See my PR and closing response here, but it looks like using the image spec |
To clarify, is it recommended that we setup both logrotate for |
I couldn't see anything for /var/log/*.log that would need rotating - kube-proxy already has rotation enabled. I'm going to be adding log rotation to daemon.json and configuring the daemon to read it so that container logs are rotated. |
I have this in my user-data before calling
I'm using amazon-eks-node-v24 (ami-0440e4f6b9713faf6) in us-east-1 created by terraform-aws-eks module |
@dpiddockcmp make a PR 😁 (to this repo) |
How about this? #74 |
Fixed with #74 |
Thanks everyone who helped with this issue. My I also noticed that the journal was growing very large so I vacuumed it. Does it make sense to "rotate" the journal as well? For example, by setting |
NPD, and any container, shouldn't be logging directly to the file system. |
@jesseshieh you can configure you app or container build to log to stdout/stderr, 12factor.net style, and let k8s log and rotate the logs. This could be as simple as adding a soft link for the current log file to |
Ah sorry, I thought npd was installed and managed by EKS and behaved this way by default, but it looks like it is something we installed. I'll look into changing the way the log is written. What do you think about the journal size though? |
just one confirmation : what you are saying is " if all my containers logs to stdout, k8 will handle the log rotation at node level " is that right ? Also its mentioned here https://kubernetes.io/docs/concepts/cluster-administration/logging/ that k8 default logging doesn't support multiline logs ? please confirm |
Corrected: No k8s doesn't, EKS still uses
That's correct, k8s just collects container stdout/stderr to a place where your preferred log streamer can deal with it. It is very common to use CNCF |
kube-proxy has nothing to do with logging of containers.
That logrotate configuration is to rotate the logs of
Correct. Technically it's not k8s, it's the docker daemon that does this, the config for that is here: https://github.com/awslabs/amazon-eks-ami/blob/master/files/docker-daemon.json#L4-L7 |
Well, that means inside EKS, we don't have to worry about log rotation at node level. right ?
Perfect. We 're planning to use fluent-kuberenetes-daemonset, but any experience on https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions for parsing multi-line stack traces to single log message ? |
Theres a log rotate helm chart here: https://github.com/stakater-charts/logrotate |
@max-rocket-internet |
Hi guys I'm running in the same issue with ami: amazon-eks-node-1.18-v20210112 (ami-0dd0589ee7a07c236), am I missing a configuration or something? |
I'm curious about troubleshooting disk pressure, let's suppose an alarm triggered for high disk utilization on a worker node and logs are getting rotated and kubelet is up and running, in this situation do we have to delete anything manually or the node heals itself? |
According to https://kubernetes.io/docs/concepts/cluster-administration/logging/, log rotation for Docker is required to not fill up the disk. GCE has it by default if kube-up.sh is used, but I can't find anything rotating
/var/log/*.log
in this repository. Here's how it works for gce.Am I correct that if I run Docker images on EKS for long enough, it will crash with full disks?
The text was updated successfully, but these errors were encountered: