Public | Automated Build

Last pushed: 2 years ago
Short Description
Restart Logspout on Docker Cloud whenever log rotation truncated the logs
Full Description


Docker image to restart Logspout on Docker Cloud whenever Docker Cloud's log rotation truncated the logs (which resulted in Logspout not logging from affected containers any more).


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.


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.


  1. Add a link to the logspout service:

        - logspout

    Please note: We require the service to be named logspout.

  2. Add the global role:

        - global
  3. Link the /var/lib/docker/containers volume:

        - '/var/lib/docker/containers:/var/lib/docker/containers:ro'

Environment Variables

  • FREQ_SECS - Seconds to wait between polling the log sizes (default: 10)
Docker Pull Command
Source Repository