I
I
Ilya Rodionov2019-05-25 14:49:58
ubuntu
Ilya Rodionov, 2019-05-25 14:49:58

Docker stack log rotation?

Colleagues, I continue my series of questions regarding the docker-stack cluster.
Now I want to ask about logging and log rotation; In my stack assembly I use portainer.io, through the face of which I deploy and upload new stack services.
It has the function of displaying container logs in its face, however, after some time, automatic rotation and deletion of logs occurs.
The question arises regarding rotation without deletion at the level of docker containers: is it possible to somehow save / rotate logs to the / logs folder on the server (without the participation of ELK, splunk) systems, since they heavily load the VM or the docker cluster (I tried) .
If this can be done, assuming by running a separate instance that will collect logs from the machine and automatically send them to the correct folder, it would be generally great.
Thanks for answers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2019-05-26
@chupasaurus

If you want direct output to a directory on the host, then output the container logs to syslog and use the host logrotate, but you will lose the ability to view from Portainer.
If you want to leave the ability to watch in the browser - log rotation is supported by Docker out of the box, the files are in

/path/to/docker/containers/container_id/container_id.json(\.\d+)?$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question