logspout-restart

Problem

Logspout stops logging after truncating a logfile from a container (#216).

The logrotate service, which is built into Docker Cloud runs logrotate with copytruncate and maxsize 10M every five minutes, so it truncates the logs whenever they reach 10MB.

Once a container's log reached 10MB, logspout essetialls stops logging this container, which could only be fixed by either restarting the container, or logspout.

Solution

We monitor the Docker logs directory /var/lib/docker/containers and sum up the size of all *.log files in its subdirectories. When the overall size has been reduced since the last check, we restart the logspout container using the Docker Cloud API.