Logrotate Setup

Asterisk/FreePBX does not set up a configuration to automatically rotate the log files for some reason.  Kind of suprising.  I only noticed because the /var/log/asterisk/full log file got to 300MB after only a month.  It would probably crash the system after awhile.  Create  the following file.

nano /etc/logrotate.d/asterisk

Now add the following  to make sure the asterisk log files are rotated weekly along with all the other log files.

/var/log/asterisk/messages /var/log/asterisk/*log /var/log/asterisk/full {
   missingok
   notifempty
   sharedscripts
   create 0640 asterisk asterisk
   postrotate
   /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}