Some of my modules have very verbose logging, and the logfiles are getting quite big.
Is there a way to specify a rolling file appender to limit the logfiles to a specific size?
Some of my modules have very verbose logging, and the logfiles are getting quite big.
Is there a way to specify a rolling file appender to limit the logfiles to a specific size?
Yes, you can use the standard docker config options for this. Here was recently posted an example: https://github.com/Azure/iotedge/issues/650#issuecomment-476033302
"createOptions": {
"HostConfig": {
"LogConfig": {
"Type": "json-file",
"Config": {
"max-size": "5m",
"max-file": "2"
}
}
}
}
This will limit the log file size to 5MB and 2 files.
If you don't want to do the settings separately for all modules you can also create a file /etc/docker/daemon.json
with the following content:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "5m",
"max-file": "2"
}
}
You then have to restart docker with sudo systemctl restart docker
.