Skip to content

Instantly share code, notes, and snippets.

@bplaxco
Last active August 29, 2015 14:07
Show Gist options
  • Save bplaxco/f3cc36b8c016e6fc8fb0 to your computer and use it in GitHub Desktop.
Save bplaxco/f3cc36b8c016e6fc8fb0 to your computer and use it in GitHub Desktop.
Example log rotation file to put in `/etc/logrotate.d/`
/var/log/<app_name>/*.log {
daily # Rotate Daily.
rotate 30 # Keep Last 30 Logs.
missingok # If file is missing, go on to the next one without issuing an error message.
copytruncate # Truncate the original log file in place after creating a copy.
compress # Old versions of log files are compressed with gzip(1) by default.
delaycompress # Postpone compression of the previous log file to the next rotation cycle.
notifempty # Do not rotate the log if it is empty.
olddir /var/log/<app_name>/history # Logs are moved into directory for rotation.
dateext # Archive old versions of log files adding a daily extension.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment