[asterisk-users] rotate of logfiles

Tzafrir Cohen tzafrir.cohen at xorcom.com
Thu Dec 2 03:26:46 CST 2010


On Thu, Dec 02, 2010 at 09:44:50AM +0100, Jonas Kellens wrote:
> Hello list.
>
> This is not a life-threatening question, but still quite important for  
> debugging.
>
> I have the following crontab :
> 15 0,8,12,17 * * * /usr/sbin/asterisk -rx 'logger rotate'
>
> Because I have debug level 9, logfiles get quite large.
>
> I notice that the rotation of the logfiles goes to plan, except at 17h15.
>
> I currently have :
>
> -rw-r--r-- 1 root root     59024 Dec  2 09:36 messages.vps.hosting        
> --> 8h15 till now
> -rw-r--r-- 1 root root         0 Dec  2 02:02 messages.vps.hosting.0      
>    --> empty
> -rw-r--r-- 1 root root     54137 Dec  2 08:14 messages.vps.hosting.1     
> --> 0h15 till 8h15
> -rw-r--r-- 1 root root    283286 Dec  1 17:14 messages.vps.hosting.2   
> --> 12h15 till 17h15
> -rw-r--r-- 1 root root    255762 Dec  1 12:14 messages.vps.hosting.3   
> --> 8h15 till 12h15
> -rw-r--r-- 1 root root         0 Dec  1 02:02 messages.vps.hosting.4      
>    --> empty
> -rw-r--r-- 1 root root     67777 Dec  1 08:12 messages.vps.hosting.5     
> --> 0h15 till 8h15
> -rw-r--r-- 1 root root    315654 Nov 30 17:14 messages.vps.hosting.6   
> --> 12h15 till 17h15
> -rw-r--r-- 1 root root    290819 Nov 30 12:13 messages.vps.hosting.7   
> --> 8h15 till 13h15
> -rw-r--r-- 1 root root         0 Nov 30 02:02 messages.vps.hosting.8      
>   --> empty
> -rw-r--r-- 1 root root     44291 Nov 30 08:08 messages.vps.hosting.9    
> --> 0h15 till 8h15
>
>
> I'm missing a logfile covering 17h15 till 0h15... and I have empty  
> logfiles...
>
> Using asterisk 1.6.2.10.

Why not use the standard logrotate package? My
/etc/logrotate.d/asterisk:

/var/log/asterisk/debug /var/log/asterisk/messages
/var/log/asterisk/full /var/log/asterisk/*_log {
        weekly
        missingok
        rotate 4
        sharedscripts
        postrotate
                /usr/sbin/invoke-rc.d asterisk logger-reload > /dev/null
2> /dev/null
        endscript
}



Note the postrotate scriptlet.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list