newsyslog
Log rotation for OS X.
New system log rotation rules are put in /etc/newsyslog.d/
Configuration
The configuration for the newsyslog.conf
files are as follows: keep 5 logs, don't trim log file based on size, rotate daily, and to compress the log files using bzip2, and not signal any processes post-rotation.
Rotate PHP logs
Add this to /etc/newsyslog.d/php.conf
, or download it here
The permissions here are set so that the developer and the httpd daemon can write to them.
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] /usr/local/steve/logs/php53.log daemon:staff 664 5 * $D0 JN /usr/local/steve/logs/php54.log daemon:staff 664 5 * $D0 JN /usr/local/steve/logs/php55.log daemon:staff 664 5 * $D0 JN /usr/local/steve/logs/php56.log daemon:staff 664 5 * $D0 JN
Rotate Apache logs
Add this to /etc/newsyslog.d/apache.conf
, or download it here
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] /usr/local/steve/apache2/logs/access_log root:wheel 644 5 * $D0 JN /usr/local/steve/apache2/logs/error_log root:wheel 644 5 * $D0 JN /usr/local/steve/apache2/logs/ssl_request_log root:wheel 644 5 * $D0 JN /usr/local/steve/apache2/logs/suexec_log root:wheel 644 5 * $D0 JN