Configure Docker Log Rotation
This page describes a configuration option for customers who want or need Docker logging. If the logs created are not automatically rotated and purged, they can grow until there is no more available storage on the volume.
To configure Docker log rotation:
Go to /etc/docker and check that the “daemon.json” file exists:
cd /etc/docker
ls
If the “daemon.json” file doesn't exist, execute following command. Otherwise, skip to step 3.
echo '{"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "5"}}' | jq . > /etc/docker/daemon.json
Adjust the max-size and max-file setting based on your organization's needs.
If the “daemon.json” file exists, add the following at the root level of the JSON configuration:
{"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "5"}}
Adjust the max-size and max-file setting based on your organization's needs.
Restart Docker.
Restart Open Collector and all beats.
After restarting the Docker, the new changes will not take affect for existing containers. New containers must be created for the new logging configuration to take affect.