Mailing List Archive

Max Log Size
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?

--
Scott Baker - Canby Telcom
RHCE - System Administrator - 503.266.8253
Max Log Size [ In reply to ]
I am right now on a pda. I answered that a few hours ago, pls look at the mailing list archive, dont have it at hand for quoting. Pls keep asking ;)

Rainer

----- Urspr?ngliche Nachricht -----
Von: "Scott Baker" <bakers at web-ster.com>
An: "rsyslog-users" <rsyslog at lists.adiscon.com>
Gesendet: 16.01.08 18:58
Betreff: [rsyslog] Max Log Size

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?

--
Scott Baker - Canby Telcom
RHCE - System Administrator - 503.266.8253
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
Max Log Size [ In reply to ]
Hi Scott,

> 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.

Regards,

Michael.

> --
> Scott Baker - Canby Telcom
> RHCE - System Administrator - 503.266.8253
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
------- End of Original Message -------
Max Log Size [ In reply to ]
> > 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
Max Log Size [ In reply to ]
> 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?

Based on the discussion I have created a small article

Log rotation based on a fixed log size
http://www.rsyslog.com/module-Static_Docs-view-f-log_rotation_fix_size.h
tml.phtml

Best regards,
Michael
Max Log Size [ In reply to ]
On Fri, 2008-01-18 at 15:43 +0100, Michael Meckelein wrote:
> > 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?
>
> Based on the discussion I have created a small article
>
> Log rotation based on a fixed log size
> http://www.rsyslog.com/module-Static_Docs-view-f-log_rotation_fix_size.h
> tml.phtml
>

Very nice. I appreciate y'all looking into it and acting on it so
quickly.

-sv