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. :)
Top comments (2)
Can config using docker-compose?
Great question! I haven't tried myself, but from docker docs it appears that there should be such possibility: docs.docker.com/compose/compose-fi...
Let me know if it works for You! :)