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


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

/var/log/asterisk/queue_log {
	rotate 36
	create 0640 asterisk asterisk
/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
endscript }

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

In recent systems that have the rotation created automatically, you may need to add the 'postrotate' block.


Did you find this article useful?