The Decider said over 4 years ago permalink Comment? (0)
Tagged: admin logrotate

Rotating Rails Logs via logrotate

No need to repeat the excellent article NullisLove

If you are doing this on a ubuntu or debian based system make sure that logrotate is actually installed. It’s easy to be fooled since apache and mysql install rotate scripts in /etc/logrotate.d

To install:

sudo apt-get install logrotate

Add your new config file to: /etc/logrotate.d

/home/my_server/www/shared/log/*.log { daily missingok rotate 7 compress delaycompress notifempty copytruncate }

Test:

sudo logrotate -d /etc/logrotate.c/my_servers_rotate_script

Force a rotate:

sudo logrotate -f /etc/logrotate.c/my_servers_rotate_script

Sometimes the easy things can just be-fuddle you!