MacOS – How to extend the time when system.log gets turned over

logsmacosterminal

Right now my system.log gets recreated every 24 hours or so with a message like:

Jan  4 00:30:01 Mac newsyslog[63416]: logfile turned over

Can I change a setting such that it will get rotated every month? Or every week?

Having a much longer time would allow for better visibility of the progression of some errors.

Best Answer

The system calls newsyslog to prune files every time a 30th minute arrives (or a little bit later if the machine is either extremely busy or sleeping).

You can see the man page for newsyslog and it's configuration file or just dive in and edit the configuration file /etc/newsyslog.conf

For a pruning each month at midnight, you would change the time from @T00 to $M1D0 or for weekly on sunday at 3 AM to $W0D03

You might want to make sure you have enough space on your filesystem for a month - especially if you get some noisy software. You can also prune on size for a while if you wish, since that's easier to know when you'll want a prune based on how large a file you expect.