Asterisk log 'full' not being written or empty after log rotate

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)

-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
-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 )
-rw-r----- 1 asterisk asterisk 0 2011-03-25 06:25 full
-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
-rw-rw---- 1 asterisk asterisk 0 2011-03-21 06:25 full.4
-rw-rw---- 1 asterisk asterisk 30014755 2011-03-22 15:55 full.5

I think mine was also a very similar issue to yours, just bad syntax.

http://www.voip-info.org/wiki/view/logrotate

I think I’ll create another cron but rotate every month, weekly is just too often for my low traffic.

hi,
many thanks. I would try this out.

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

/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null

The config now is at it is of a fresh install have not changed anything.

You need to embrace the commands to asterisk with apostrophes:

/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null

Otherwise it is executes as asterisk -rx logger instead of asterisk -rx logger rotate

Thanks for the reply.
it is a fresh install about a month ago. This is my logrotate entry.

How did u fix your issue?

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
}

How are you rotating the logs?