[TriLUG] Debian logfile rotation question
Michael Mueller
mmueller at ss7box.com
Wed Jun 12 16:23:56 EDT 2002
I included the /etc/cron.daily/syslogd script below.
On Wednesday 12 June 2002 11:02, James LewisMoss reputedly wrote:
> >>>>> On Wed, 12 Jun 2002 09:19:10 -0400, Michael Mueller
> >>>>> <mmueller at ss7box.com> said:
>
> Michael> Does anybody know why Debian rotates log files with
> Michael> "savelog" and "logrotate" while RH and Mandrake use only
> Michael> "logrotate"?
>
> Michael> I see syslogd-listfiles and savelog at heart of
> Michael> /etc/cron.daily/sysklogd. Are these methods unique to
> Michael> Debian? I use RH6.1 and Mandrake 8.1 and they do not have
> Michael> syslogd-listfiles or savelog commands.
>
> Afaik (I use msyslog now rather than sysklogd) all debian packages
> should be using logrotate now. But syslogd-listfiles extracts the log
> files from a syslog.conf so all the syslog written files get rotated
> (since local changes to the syslog.conf file can occur this helps
> automate the rotation list).
Aha. When you change /etc/syslog.conf you may need to manually add another
stanza to the /etc/logrotate.d/syslog file in the RH and Mandrake distros.
The Debian way is to use syslogd-listfiles to read the /etc/syslog.conf and
produce a list of files for daily, weekly, etc. rotation. Settings in the
syslog.conf indirectly affect whether a lof file is rotated daily or weekly.
Is logrotate the preferred way of doing things now? In Debian 2.2r6 for
SPARC it certainly appears that both logrotate and /etc/cron.daily/sysklogd
are being used.
>
> Michael> On my RH6.1 systems (slated for migration to Debian) the
> Michael> logrotate facility is used to in the logrotate script in
> Michael> /etc/cron.daily. I had to add /etc/rc.d.init.d/syslog
> Michael> restart to get new files handles for the loggers. The
> Michael> Mandrake 8.1 system is same. I notice that sysklogd
> Michael> restarts the syslogger and the kernel logger. It's appears
> Michael> that I have solved a problem the Debians solved in 1998.
>
> Not sure what you are saying here.
See "restart" in script below.
>
> Michael> Is savelog a better logrotate with compressing at cycle 1
> Michael> instead of 0?
>
> logrotate can compress at cycle whatever. It's a config file
> setting.
>
> Michael> In sysklogd what are the permission changes for in files
> Michael> listed with "syslogd-listfiles --auth"? -- Mike Mueller
>
> Huh?
See script below.
>
> Jim
Here is /etc/cron.daily/sysklogd from Debian 2.2r6 for SPARC:
#! /bin/sh
# sysklogd Cron script to rotate system log files daily.
#
# If you want to rotate other logfiles daily, edit
# this script. An easy way is to add them manually
# or to add -a to syslogd-listfiles and add some grep
# stuff
#
# Written by Martin Schulze <joey at debian.org>.
# $Id: cron.daily,v 1.2 1998/01/02 03:07:21 joey Exp $
cd /var/log
for LOG in `syslogd-listfiles`
do
if [ -f $LOG ]; then
savelog -g adm -m 640 -u root -c 7 $LOG >/dev/null
fi
done
for LOG in `syslogd-listfiles --auth`
do
if [ -f $LOG ]; then
chown root.adm $LOG
chmod o-rwx $LOG
fi
done
# Restart syslogd
#
/etc/init.d/sysklogd reload
--
Mike Mueller
www.ss7box.com
More information about the TriLUG
mailing list