macOS Logs – How to Keep All System Logs Forever

logsmacos

In console app I can see only couple system.log.${i}.gz archived log files that can only show me info about last 10-15 days.
How to keep all logs archived somewhere, forever ?

Best Answer

The log files are rotated and eventually removed by the asl system. You can change the configuration by editing /etc/asl.conf under sudo. Start Terminal.app and issue this command:

sudo -e /etc/asl.conf

You'll find in there a comment stating that rules for /var/log/system.log follows, the first line looks like this:

> system.log mode=0640 format=bsd rotate=seq compress file_max=5M all_max=50M

Change that to look like this:

> system.log mode=0640 format=bsd rotate=seq compress file_max=5M all_max=9999G ttl=99999

This means that each seperate log file will be maximum 5M. Normally the asl system removes log files when either they exceed the all_max limit (before 50 megabyte, now 9999 gigabytes) or when the file is older than ttl days (before 7 days, now 99999 days).