[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [atomic-devel] cron job for logrotate on containers



On 12/16/2014 11:10 AM, Lokesh Mandvekar wrote:
> I have a script which would run logrotate on all running docker containers.
> Plan is to have this installed via the docker rpm into /etc/cron.daily. Posting here 
> for further discussion as per Colin's suggestion before I include it in any rpms.
>
> ---
> #!/bin/sh
>
> for id in $(docker ps -q); do
>     docker exec $id logrotate -s /var/log/logstatus /etc/logrotate.conf >/dev/null 2>&1
> done
> exit 0
> ---
>
> Of course this assumes that logrotate is installed on the containers and will ignore any failures
>
> Comments/questions?
This script would run at approximately the same time as the system
logrotate script runs.

The only problem I see with this is there is no way for the admin to
stop the script from running, if
he does not want logrotate to happen within the containers.  We could
fix this by adding a field
to /etc/sysconfig/docker (logrote=true) or something like that.

We want this script for containers that have logs written within the
container, while we don't recommend doing this, we still want to support
the use case.

We want to add this to the docker-1.4 release, but would like to get
other peoples comments.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]