Last active
August 29, 2015 14:01
-
-
Save hectorperez/6667f7e2ea558e46030f to your computer and use it in GitHub Desktop.
logrotate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/logrotate.conf | |
/etc/logrotate.d/... | |
/home/deploy/APPNAME/current/log/*.log { | |
daily | |
missingok | |
rotate 7 | |
compress | |
delaycompress | |
notifempty | |
copytruncate | |
} | |
How It Works: | |
daily – Rotate the log files each day. You can also use weekly or monthly here instead. | |
missingok – If the log file doesn’t exist, ignore it | |
rotate 7 – Only keep 7 days of logs around | |
compress – GZip the log file on rotation | |
delaycompress – Rotate the file one day, then compress it the next day so we can be sure that it won’t interfere with the Rails server | |
notifempty – Don’t rotate the file if the logs are empty | |
copytruncate – Copy the log file and then empties it. This makes sure that the log file Rails is writing to always exists so you won’t get problems because the file does not actually change. If you don’t use this, you would need to restart your Rails application each time. | |
http://excid3.com/blog/logrotate-rails-production-logs/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment