Canonical postrotate command for asterisk log rotation


Debian’s asterisk package brings a /etc/logrotate.d/asterisk file which looks like:
/var/log/asterisk/debug /var/log/asterisk/messages /var/log/asterisk/full /var/log/asterisk/*_log {
rotate 4
/usr/sbin/invoke-rc.d asterisk logger-reload > /dev/null 2> /dev/null
My questions are about this postrotate section.
If I’m not mistake, this runs /etc/init.d/asterisk logger-reload.
Looking at /etc/init.d/asterisk on bullseye, I can’t read any logger-reload entry.

My questions are:

  1. Are these postrotate script still required ?
  2. In the ages of systemd and Asterisk 16 or later, which is the recommended postrotate script ?

Best regards

  1. I’ve not observed any harmful consequence from using this obsolete “/usr/sbin/invoke-rc.d asterisk logger-reload > /dev/null 2> /dev/null”. How can I explain this ?


Take a look in invoke-rc.d you will discover that systemd is used if installed


If you don’t do an appropriate postrotate operation, Asterisk will continue to log to the old file (and even do so after it is removed from the directory).

What about using:
asterisk -rx ‘logger rotate’
instead of
/usr/sbin/invoke-rc.d asterisk logger-reload > /dev/null 2> /dev/null

Do Debian’s asterisk systemd settings include such logger-reload command ?
If negative, has this “/usr/sbin/invoke-rc.d asterisk logger-reload > /dev/null 2> /dev/null” any chance to work successfully ?

That would replace the whole of the logrotate configuration, so would not be appropriate as a post process script. If it were used as one you would probably want to suppress the output.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.