How to change the Log Rotation Policy on FreePBX Distro

The FreePBX distro has a poor log rotation policy by default. It will rotate the file daily and keep only 30 days worth of data.

That means that if you install any queue stats or metrics package, you will only have 30 days worth of data to analyse. It also means that you won't have the source logs as backups if anything wrong happens to your database.

Our advise is to use a more sensitive log rotation policy: monthly rotation, leaving 36 months worth of data. To change that you have to edit the file

/etc/logrotate.d/asterisk

Look at the queue_log section (at the top), and change it to be like this:

/var/log/asterisk/queue_log {
	monthly
	missingok
	rotate 36
	notifempty
	sharedscripts
	create 0640 asterisk asterisk
}

Leave the rest of the file as is, with no other modifications but to change "daily" to "monthly" and "rotate 30" to "rotate 36"


Did you find this article useful?