[359] in RedHat Linux List
Re: cron logs and logrotate (fwd)
daemon@ATHENA.MIT.EDU (Jos Vos)
Tue Oct 22 09:33:55 1996
From: Jos Vos <jos@xos.nl>
To: redhat-list@redhat.com
Date: Tue, 22 Oct 1996 15:29:52 +0200 (MET DST)
In-Reply-To: <199610211704.NAA24097@brisco.telogy.com> from "Dan Hopper" at Oct 21, 96 01:04:58 pm
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
> > > Any solution for this?
> >
> > cd /var/log
> > mv messages messages.old
> > killall -HUP syslogd
> > killall -HUP klogd
> > # do whatever with messages.old
> >
> > This type logic needs to be built into the log rotator.
> >
> > Erik
>
> One should be careful with this type of procedure when using the logrotate
> script. For example, the first time, you move the logs to a temp dir, run
> logrotate on them, it doesn't do anything because it's the first time, then
> the next time your cron job runs, you move the new logs on top of the old
> ones in the temp dir, losing the initial logs instead of rotating them.
>
> Doubtless integrating this type of logic into the script could be made to
> work as desired.
In the meantime, I use a logrotate.conf file which signals syslogd using
a shell command associated with the last entry. Seems to work fine.
I found out that building this logic into logrotate itself is not what we
want, because I have several syslogd's, one for each chroot environment on
my system, and I want to send each of them a SIGHUP at the appropriate time.
Furthermore, we changed the logic so that it moves the logfile i.s.o.
copying it, so that existing programs having the file open will not
be disturbed (this includes syslogd, until it is signalled).
And next, for the same reason (some processes might be busy with the
file), compression of the (moved) files *.000 is delayed: compression
is done the next time, when moving *.000 to *.001.
And last but not least I added a flag "create", that creates a new logfile
after moving the old one. Some application log files might want a logfile
to exist, others (syslogd) create a new one themself.
--
-- Jos Vos <jos@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
--
PLEASE read the Red Hat FAQ, Tips, HOWTO and the MAILING LIST ARCHIVES!
________________________________________________________________________
http://www.redhat.com/RedHat-FAQ http://www.redhat.com/RedHat-HOWTO
http://www.redhat.com/RedHat-Tips http://www.redhat.com/mailing-lists
------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null