> > Seth Vidal asks a good question:
> >
> > http://skvidal.wordpress.com/2008/01/16/fixed-size-log-outputs/
> >
> > Basically he wants to know if you can have syslog output a fixed log
> > size, and the roll to another name? So say I only wanted 1 meg log
> > files, and then after I reach 1 meg change the name too foobar.log.1
> > or something.
> >
> > I swear I thought this was possible with rsyslog, but I can't find
> > anything in the docs. Is it possible? Was I hallucinating when I
> > remembered this feature?
> 
> Logrotate is able to rotate based on file size. What you could do (as
a
> workaround if rsyslog can't do it directly) is use inotify or a
similar
> tool
> to monitor the log file and then when it reaches the size you want
call
> logrotate to do the logrotation.

I just confirmed, it is possible with rsyslog using outchannel.

Use something like this in your rsyslog.conf: 

#start log rotation via outchannel
$outchannel
log_rotation,/var/log/log_rotation.log,52428800,/home/mm/./logrot

*.*     $log_rotation
#end log rotation

/home/mm/logrot is a simple script with a single command:
mv -f /var/log/log_rotation.log /var/log/log_rotation.log.1

In short: rsyslog always writes to log_rotation.log. If log_rotation.log
reaches 50 mb, the file is moved to log_rotation.log.1. With this, 100
mb are the maximum amount which is used for logging.

Best regards,
Michael
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog

Reply via email to