-
Notifications
You must be signed in to change notification settings - Fork 43
purging log files in a production environment
Shashike Jayatunge edited this page Jul 30, 2021
·
3 revisions
If you are using ubuntu server 20.04+ logrotate should be installed out of the box. Crack open the configuration file:
sudo nano /etc/logrotate.conf
drop in the following configuration to rotate logs for rails:
/var/www/violet/current/log/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
copytruncate
}
after editing the configuration, run the following for the change to take effect:
sudo /usr/sbin/logrotate -f /etc/logrotate.conf
source: https://gorails.com/guides/rotating-rails-production-logs-with-logrotate