09/30/2022, 9:22 AM
Hi, How can I set a config for log rotation of Docker engine? I know that we can set it manually and restart docker daemon, but I think its not a good solution, because after adding every node we should set the config manually (and restart docker daemon) Size of log file of my RKE container is about 4GB!!


09/30/2022, 1:53 PM
Cannot answer your question directly but in our case we deployed a daemonset that runs a cron periodically.
truncate -s 0 /home/dockerlogs/*/*-json.log
+ a mount to
Could also be a cronjob deployment.
🙌 1


10/01/2022, 2:21 AM
Docker handles all the logging unlike something like containerd so you should configure it in the daemon.json like shown in this article: Instead of doing it manually on all the nodes I personally would use config management tooling like Ansible or Salt to change it and keep it uniform on the nodes.
🙌 1


10/01/2022, 7:30 AM
Thanks @white-park-86714, It’s a good option. Thanks @bulky-sunset-52084, but when you send a request to add a node from rancher UI, it just creates a node from your provisioner and then installs docker and RKE on it, I’m not sure you can set docker daemon config on each node of the cluster at the bootstrap time using Ansible. Unless you add node from Ansible config(I don’t know rancher allow us add node to downstream clusters from Ansible or not), in that case I’m not sure it can let us set docker daemon config from Ansible or not!