DEV Community

Serepas Filippas
Serepas Filippas

Posted on

Docker Logs, continue....

In my previous post I have explained how to set limits in docker logs. But after that we can see that, for some reason, docker after reach the max-size create a second file with extension log.1.

I don't know, yet, why this happening but, after the lattest file reach again the max-size, docker start write, from begin the first file..

Set limits to the number of logs files!!!

So you need to add one more argument to your docker-compose.yml, for example,

logging:
       driver: "json-file"
       options:
           max-size: "100k"
           max-file: "3"
Enter fullscreen mode Exit fullscreen mode

Now docker will create three logs files with these extensions:
.log, .log.1, .log.2
When first one hit the max-size will create the next one and etc.
When docker reach the limit in last file .log.2 will recreate the first one .log .

Top comments (0)