[Asterisk-Users] Syslog file size

Paul digium-list at 9ux.com
Mon Sep 12 05:30:57 MST 2005


Tzafrir Cohen wrote:

>On Mon, Sep 12, 2005 at 01:00:45PM +1000, YT Lim wrote:
>  
>
>>Does anyone know how to limit syslog file size?
>>Logrotate only rotates log files (i.e. irrelevant of
>>file size), and a log file size can grow extremely
>>large before it is rotated.
>>    
>>
>
>Logrotate is invoked (by default) as a daily cron job and then decides if 
>it should rotate/delete logs . Usually it only rotates by dates, but it 
>can also rotate by log file size.
>
>Still, it won't monitor the log files constantly and rotate as soon as
>the logs reach a certain size, if that is what you need.
>
>Weekly rotation is usually good enough. Daily rotation won't save you
>enough time behind. Try to make your programs less verbose.
>
>  
>
You can have a cron job do "/usr/sbin/logrotate someconfigfile" as often 
as you want. Just make sure someconfigfile has reasonable parameters for 
things like size so it won't be doing rotation and compression unless 
needed. To get an idea of resources used when no rotation is needed just 
do something like "time /usr/bin/logrotate someconfigfile" when the size 
argument is met and then do it again right away. Here is what I get when 
the asterisk logs don't need to be rotated:

real    0m0.002s
user    0m0.001s
sys     0m0.001s




More information about the asterisk-users mailing list