Configure logrotate for Asterisk logfiles on CentOS

Asterisk PBXlogrotate is an utility specially designed for ease rotation of large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.

Normally, logrotate is run as a daily cron job. By default it lacks the configuration file for Asterisk logfiles. Here I’ll suggest an example but you may customize it based on your needs.

Open /etc/logrotate.d/asterisk file with your favorite text editor:

and paste the following:

Now you can check if it’s working:

Now check /var/log/asterisk and ensure logfiles have been rotated.

Run:

to get details about configuration file directives.

Be sociable 🙂 Share!

Comments/Коментарі/Комментарии