Hi,
I have couple of containers running on el7.
The default logging driver is json.
The json log file is only one and log are getting accumulated to the file since apr.
I am in the process of creating a log rotation for it.
I created the daemon file
/etc/docker/daemon.json
:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
Added below information.
/var/lib/docker/containers/*/*.log {
rotate 7
daily
compress
missingok
delaycompress
copytruncate
}
I restarted the docker after making the changes.
systemctl restart docker
My Question is ,
What the prerequisite that i should do to get this done.
Should i take a back up of the running container using below command
docker save --output portal.tar dockername
What other steps that should i follow before implementing log rotate.