Asterisk has 5 different main log files:
-
/var/logs/asterisk/messages
-
/var/logs/asterisk/queue_log
-
/var/logs/asterisk/event_log
-
/var/logs/asterisk/debug
-
/var/logs/asterisk/full
Here are some parameters description:
-
missingok: If the log file is missing, go on to the next log file without issuing an error message.
-
copytruncate: Truncate the original log file to zero size in place after creating a copy, instead of moving the old log file and optionally creating a new one
-
rotate 7: Log files are rotated 7 times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.
-
compress: Old versions of log files are compressed with gzip to save disk space.
-
size: Rotate only if the log file reaches the specified limit
-
notifempty: Do not rotate the log if it is empty
-
sharedscripts
postrotate
/etc/init.d/lighttpd reload
endscript: The lines between postrotate and endscript (both of which must appear on lines by themselves) are executed after the log file is rotated. These directives may only appear inside a log file definition. In our case we are reloading lighttpd. Other opting could be send –HUP single using kill command.
There are different ways you can configure the rotation:
/var/log/asterisk/full {
rotate 7
daily
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
endscript
}
/var/log/asterisk/messages {
rotate 12
weekly
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
endscript
}