Last active
March 1, 2024 22:14
-
-
Save johncarney/fd72402a0c8119eb48f5 to your computer and use it in GitHub Desktop.
Example newsyslog configuration for rotating Rails log files on Mac OS X.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] | |
/Users/your-username/path-your-rails-project/log/*.log your-username:staff 644 4 * $D0 GJ | |
# NOTES | |
# | |
# Place file in /etc/newsyslog.d | |
# '$D0' under 'when' tells newsyslog to rotate logs daily at midnight. | |
# Alternatively you could use '24' for 'when', which would specify "every 24 hours" | |
# '*' under 'size' specifies that logs should be rotated regardless of their size. | |
# 'G' under 'flags' tells newsyslog that the 'logfilename' is a pattern and it should rotate all log files matching the pattern. | |
# 'J' under 'flags' specifies that rotated logs should be compressed using bzip2. |
Have you ever noticed your rails starts failing to write to logs after they are rotated? Wondering if this has to do with the pid_file option being left out.
Hello, does anyone know how to let Rails point to newly rotated logfile? Rails still logs to old log file after rotation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thanks!
I guess you use this in development environment?