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

_______________________________________________
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to