Today, I deleted 130 GB of logs. I don’t know who started those Docker containers, but let me share a valuable concept: log rotation.
For example, one can define it in daemon.json:
{ "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3", }
}
or directly when starting a container:
docker run \ --log-driver=json-file \ --log-opt max-size=10m \ --log-opt max-file=3 \ my-image
or even as an Ansible script:
- name: Start Grafana loki docker_container: name: my-container image: my-image state: started log_driver: json-file log_options: max-size: "10m" max-file: "3"
There’s no need to store 130 GB of logs. Really. 🙂
Discover more from Coursity
Subscribe to get the latest posts sent to your email.