Re: [gentoo-user] [lame logrotate Q]
On Monday 21 December 2009 05:52:55 Dale wrote: Harry Putnam wrote: Can anyone show me how to write a logrotate rule that will rotate on either size or age? I use some very simple scripting for yrs but don't really see how to rotate on more than one condition. I'd like to rotate a certain log weekly or over 7000k and keep no more than 12 rotations for whatever reason. /var/log/debug.log { create 0600 reader wheel weekly || size=7000k rotate 12 postrotate /etc/init.d/rsyslog reload /dev/null 21 || true endscript } Is clearly NOT the right way to go. Any know how to do it? man logrotate has a few examples that may help. Here is one. /var/log/httpd/access.log /var/log/httpd/error.log { rotate 5 mail w...@my.org size 100k sharedscripts postrotate /usr/bin/killall -HUP httpd endscript } I notice that the size part is on its own line which may be the issue. That will rotate his log when it gets to 100k, and only when it gets to 100k. The OP wants to rotate when either the log file is a certain size, or every week, whichever comes first. Logrotate does not support that feature. -- alan dot mckinnon at gmail dot com
Re: [gentoo-user] [lame logrotate Q]
On Mon, 21 Dec 2009 08:42:43 +0200, Alan McKinnon wrote: That will rotate his log when it gets to 100k, and only when it gets to 100k. The OP wants to rotate when either the log file is a certain size, or every week, whichever comes first. Logrotate does not support that feature. What happens if you set up two separate rules, one to rotate at 100K and one at 7 days? -- Neil Bothwick Gravity isn't easy, but it's the law. signature.asc Description: PGP signature
Re: [gentoo-user] [lame logrotate Q]
Harry Putnam wrote: Can anyone show me how to write a logrotate rule that will rotate on either size or age? I use some very simple scripting for yrs but don't really see how to rotate on more than one condition. I'd like to rotate a certain log weekly or over 7000k and keep no more than 12 rotations for whatever reason. /var/log/debug.log { create 0600 reader wheel weekly || size=7000k rotate 12 postrotate /etc/init.d/rsyslog reload /dev/null 21 || true endscript } Is clearly NOT the right way to go. Any know how to do it? man logrotate has a few examples that may help. Here is one. /var/log/httpd/access.log /var/log/httpd/error.log { rotate 5 mail w...@my.org size 100k sharedscripts postrotate /usr/bin/killall -HUP httpd endscript } I notice that the size part is on its own line which may be the issue. Dale :-) :-)