binbashing/logrotate

By binbashing

Updated 4 days ago

A simple docker container based on Alpine the does logrotate.

Image

1.8K

Build and Push

Logrotate

A simple docker container based on Alpine the does logrotate.

Usage

  • Use shared volumes to share log files with a container that produces logfiles
  • Set LOGROTATE_PATTERN etc. to configure what logrotate watches, log file size, etc.
docker run -it --rm \
  --env CRON_SCHEDULE='' \
  --env LOGROTATE_SIZE=1M \
  --env LOGROTATE_PATTERN=/var/logs/example-app/*.log \
  -v logs:/var/logs/example-app
  binbashing/logrotate

Customization

Most options below are substituted into the config file for logrotate, so please refer to the Manpage for logrotate for detailled documentation.

OptionDefaultDescription
CRON_SCHEDULE0 * * * *Cron schedule for logrotate command
LOGROTATE_SIZE100MMaximum size of log files
LOGROTATE_MODEcopytruncateMode of log rotation
LOGROTATE_PATTERN/logs/*.logPath pattern of log files to manage
LOGROTATE_ROTATE0Number of old log files to keep

Docker Pull Command

docker pull binbashing/logrotate