Re: [gentoo-user] syslog-ng logrotate question
Hehe, you beat me to it on the syslog-ng stuff, my example writing took to long :-) Good work! Covington, Chris wrote: Hopefully this will take care of it. Now the original question: How can I make sure the 'weekly' logrotate happens on Sunday morning and not Monday, Tuesday, etc.? From the logrotate man page: *weekly* Log files are rotated if the current weekday is less then the weekday of the last rotation or if more then a week has passed since the last rotation. This is normally the same as rotating logs on the first day of the week, but it works better if logrotate is not run every night. So, one option would be to move the logrotate.cron script to cron.weekly, but since that runs on Saturday instead of Sunday you'd either have to change when cron.weekly runs (the "rm" lines in crontab) or do like that original example. *shrug* -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] syslog-ng logrotate question
> Hopefully this will take care of it. Now the original question: How > can I make sure the 'weekly' logrotate happens on Sunday morning and not > Monday, Tuesday, etc.? Which I just also found in /etc/crontab! I guess that settles it. Chris -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] syslog-ng logrotate question
Covington, Chris wrote: On Sun, 2005-01-16 at 12:21 -0600, Ben Maas wrote: Covington, Chris wrote: Hi all, How can I make sure that my weekly logrotation occurs on Sunday morning? You'll need to change your crontab. First though, I assume this means you don't want you logs to be rotated dailty as is the default when you emerge logrotate. The dafault is that the /etc/cron.daily/logrotate.cron script is run daily, which rotates your logs. but the logrotate.cron cron job occurs /etc/cron.daily. On my Red Hat systems, this 'weekly' rotation always occurs Sunday morning (for instance, with /var/log/maillog) and the logrotate cron job still runs in /etc/cron.daily. On my Gentoo system I have syslog-ng.conf setup like the example on http://www.gentoo.org/doc/en/gentoo-security.xml and I also have /etc/cron.daily/logrotate.cron but my maillog didn't rotate this morning (I'm using Postfix as the MTA). My /var/lib/logrotate.status on the Gentoo system looks like this: grendel log # cat /var/lib/logrotate.status logrotate state -- version 2 "/var/log/messages" 2005-1-16 "/var/log/wtmp" 2005-1-16 For some reason /var/log/maillog isn't in there, although /var/log/maillog exists. You may modify the file /etc/logrotate.d/syslog-ng. Just extend the messages entry: /var/log/messages /var/log/maillog { sharedscripts postrotate /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true endscript } Peter -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] syslog-ng logrotate question
> On the Red Hat system /var/lib/logrotate.status has maillog in it. > So I guess the realy problem is logrotate isn't rotating > my /var/log/maillog, and not what I originally asked. ;< I just discovered /etc/logrotate.d/syslog-ng. I changed it to: --- # $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.logrotate,v 1.2 2004/07/18 02:25:02 dragonheart Exp $ # # Syslog-ng logrotate snippet for Gentoo Linux # contributed by Michael Sterrett # /var/log/maillog /var/log/syslog /var/log/daemon.log /var/log/cron.log /var/log/auth.log /var/log/user.log /var/log/kern.log /var/log/lpr.log /var/log/debug /var/log/messages { sharedscripts postrotate /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true endscript } --- Hopefully this will take care of it. Now the original question: How can I make sure the 'weekly' logrotate happens on Sunday morning and not Monday, Tuesday, etc.? Chris -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] syslog-ng logrotate question
On Sun, 2005-01-16 at 12:21 -0600, Ben Maas wrote: > Covington, Chris wrote: > > Hi all, > > > > How can I make sure that my weekly logrotation occurs on Sunday > > morning? > > You'll need to change your crontab. > > First though, I assume this means you don't want you logs to be rotated > dailty as is the default when you emerge logrotate. The dafault is that > the /etc/cron.daily/logrotate.cron script is run daily, which rotates > your logs. Thanks for your help. I didn't explain this properly. I have logrotate.conf configured to rotate logs weekly: --- # $Header: /var/cvsroot/gentoo-x86/app-admin/logrotate/files/logrotate.conf,v 1.2 2004/07/18 01:58:24 dragonheart Exp $ # # Logrotate default configuration file for Gentoo Linux # # See "man logrotate" for details # rotate log files weekly weekly #daily # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # uncomment this if you want your log files compressed #compress # packages can drop log rotation information into this directory include /etc/logrotate.d notifempty nomail noolddir # no packages own lastlog or wtmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp rotate 1 } # system-specific logs may be also be configured here. --- but the logrotate.cron cron job occurs /etc/cron.daily. On my Red Hat systems, this 'weekly' rotation always occurs Sunday morning (for instance, with /var/log/maillog) and the logrotate cron job still runs in /etc/cron.daily. On my Gentoo system I have syslog-ng.conf setup like the example on http://www.gentoo.org/doc/en/gentoo-security.xml and I also have /etc/cron.daily/logrotate.cron but my maillog didn't rotate this morning (I'm using Postfix as the MTA). My /var/lib/logrotate.status on the Gentoo system looks like this: grendel log # cat /var/lib/logrotate.status logrotate state -- version 2 "/var/log/messages" 2005-1-16 "/var/log/wtmp" 2005-1-16 For some reason /var/log/maillog isn't in there, although /var/log/maillog exists. On the Red Hat system /var/lib/logrotate.status has maillog in it. So I guess the realy problem is logrotate isn't rotating my /var/log/maillog, and not what I originally asked. ;< The logrotate.conf is almost exactly the same on the Red Hat system, and there's nothing about postfix in /etc/logrotate.d/ so it's puzzling. Chris -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] syslog-ng logrotate question
Ben Maas wrote: dailty > dafault I apologize for all the marbles in mouth! -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] syslog-ng logrotate question
Covington, Chris wrote: Hi all, How can I make sure that my weekly logrotation occurs on Sunday morning? You'll need to change your crontab. First though, I assume this means you don't want you logs to be rotated dailty as is the default when you emerge logrotate. The dafault is that the /etc/cron.daily/logrotate.cron script is run daily, which rotates your logs. If that is not what you want, then you'll need to do two things. First, disable the "daily" logrotation: chmod -x /etc/cron.daily/logrotate.cron Second, add a new line to your crontab instructing your system to only run the rotation on Sunday mornings (in my example, at 6am). crontab -e Add this line: 0 6 * * sun /usr/sbin/logrotate /etc/logrotate.conf For more infomation take a look at the crontab man page ("man crontab") thanks Chris Your welcome. -- gentoo-user@gentoo.org mailing list
[gentoo-user] syslog-ng logrotate question
Hi all, How can I make sure that my weekly logrotation occurs on Sunday morning? thanks Chris -- gentoo-user@gentoo.org mailing list