Topic: Ruby on Rails

Rotate Rails Logs with logrotate

This technique requires root shell access. The logrotate program on linux servers handles rotation and compression of system logs. When logs get too big after being written to for a long time, logrotate will take the old log data and archive it somewhere else. By default, logrotate only watches system logs which are usually located in /var/log/. To rotate Rails logs, a bit of configuration is needed. Verify that the logrotate cron job (scheduled task) is enabled with the following: $ ls /etc/cron.daily Make sure logrotate is scheduled. The configuration file for logrotate is located at /etc/logrotate.conf. To enabled log rotation of Rails logs, open it up with your preferred… go on →