Posted about 7 years ago. Visible to the public.

Rotating rails application log files

To prevent the log files of a rails application to grow without limit you should setup log rotation. There are several ways to do this. Here is a simple solution using logrotate.

Create a config file (usually something like /etc/logrotate.d/my-app):

/full/path/to/my_rails_app/log/*.log { weekly missingok rotate 52 compress delaycompress notifempty copytruncate }

This will rotate logs on a weekly basis and keep them for a year. Notice that the copytruncate option is essential to prevent your rails app from having to reboot.

Owner of this card:

Last edit:
about 7 years ago
Posted by jan0sch to jan0sch's deck
This website uses short-lived cookies to improve usability.
Accept or learn more