Equivalent of logrotate on OSX

Based on Brian Armstrong’s answer, here’s something with a little more explanation and a correction. This handles the log created by postgres on OSX installed by Homebrew. Located at /etc/newsyslog.d/postgresql.conf: # logfilename [owner:group] mode count size(KB) when flags [/pid_file] [sig_num] /usr/local/var/postgres/postgresql.log : 600 2 2048 * J /usr/local/var/postgres/postmaster.pid This will rotate the log file when … Read more

How can I monitor what logrotate is doing?

cat /var/lib/logrotate/status To verify if a particular log is indeed rotating or not and to check the last date and time of its rotation, check the /var/lib/logrotate/status file. This is a neatly formatted file that contains the log file name and the date on which it was last rotated. Taken From: https://www.digitalocean.com/community/articles/how-to-manage-log-files-with-logrotate-on-ubuntu-12-10

logrotating files in a directories and its subdirectories

How deep do your subdirectories go? /var/log/basedir/*.log /var/log/basedir/*/*.log { daily rotate 5 } Will rotate all .log files in basedir/ as well as all .log files in any direct child of basedir. If you also need to go 1 level deeper just add another /var/log/basedir/*/*/*.log until you have each level covered. This can be tested … Read more