Rotating Logs for Rails on Passenger (Mac)

Posted by jkahn on August 05, 2013 · 1 min read

Like many Linux utilities not included on Mac OS X, Homebrew can provide logrotate to more effectively manage large log files. Setup:

  1. brew install logrotate
  2. Once installation is complete, create a configuration file for logrotate. I chose to use the same configuration defined here: http://overstimulate.com/articles/logrotate-rails-passenger and named the file "logrotate.conf".
  3. We can now kick logrotate in to gear:
    /usr/loca/sbin/logrotate -f -s logrotate.status logrotate.conf

Note that in the above, I defined explicitly where to stick the logrotate status file so that it is owned by the current user and not reliant on sudo, etc.