Asterisk log 'full' not working as it should

This is a bit strange issue which is about the asterisk full log (/var/log/asterisk/full ).

The log is being rotated properly like renaming it to full.1, full.2, full.3 etc. But we see that the new log file created full is empty and it still keep writing to an old file full.1.

When we did a asterisk restart it will then start writing to the log ‘full’ or a system reboot. I did this manually a few times and last couple of days did not do a left it empty. Then I found that the full.1 and full.2 also was empty and it was still writing to old file full.3

This is not a normal behavior. Does anyone know on why this is happening?

My System configuration details are as below

Operating System - Ubuntu 10.10

Asteirsk Version: 1.4.40

FreePBX version: 2.8

File listing - linux Console (Today)

[color=#FF0000]-rw-rw---- 1 asterisk asterisk 0 2011-03-29 06:25 full
-rw-rw---- 1 asterisk asterisk 0 2011-03-28 06:25 full.1
-rw-rw---- 1 asterisk asterisk 0 2011-03-27 06:25 full.2[/color]
-rw-rw---- 1 asterisk asterisk 27017185 2011-03-29 06:29 full.3
-rw-rw---- 1 asterisk asterisk 6621497 2011-03-26 13:32 full.4
-rw-rw---- 1 asterisk asterisk 10641959 2011-03-25 15:57 full.5

File listing - linux Console (few days ago )
[color=#FF0000]-rw-r----- 1 asterisk asterisk 0 2011-03-25 06:25 full[/color]
-rw-rw---- 1 asterisk asterisk 10413172 2011-03-25 15:14 full.1
-rw-rw---- 1 asterisk asterisk 9950769 2011-03-24 13:37 full.2
[color=#FF0000]-rw-rw---- 1 asterisk asterisk 0 2011-03-21 06:25 full.4[/color]
-rw-rw---- 1 asterisk asterisk 30014755 2011-03-22 15:55 full.5

Are you running the asterisk -rx “logger reload” command after renaming the file?

it is a fresh install about a month ago.

Here is the logrotate entry under /etc/logrotate.d/asterisk

/var/log/asterisk/*log {
missingok
rotate 5
weekly
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx logger reload > /dev/null 2> /dev/null
endscript
}

/var/log/asterisk/full {
missingok
rotate 5
daily
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx logger reload > /dev/null 2> /dev/null
endscript
}

/var/log/asterisk/cdr-csv/*csv {
missingok
rotate 5
monthly
create 0640 asterisk asterisk
}

Whenever I rotate my full log, I just cd /var/log/asterisk then rm full, then asterisk -rx “logger reload”

everything always works fine. although you don’t have to delete it if you do not want, you can just rename as you are doing… try deleting and see if that changes anything.

maybe delete full.1 and full.2 full.3 and so on

As per my understanding the logrotate in asterisk is a automated process done by the logrotate like the script i showed in the earlier reply. I guess this is how most of the asterisk systems work. We have other asterisk systems but different version in place but have never seen this happening in any of those.

The CLI command needs to be a single argument in the shell, i.e. you must put “logger reload” in some form of quotes.

Thanks for the reply and advice.

So I would need to change those lines in logrotate like this.

[color=#FF0000]/usr/sbin/asterisk -rx “logger reload” > /dev/null 2> /dev/null[/color]