I have been trying to determine the cause for logs not rotating.
Syslog is not rotating at all.
logrotate will only work if I manually run the command. It originally would not work at all, until first running it with force command. Now force command is not needed, but I still have to run it manually.
How can I easily verify cron daily is running? I see it listed when running top.
Some Info:
Code:
ls -alt cron.daily
total 24
drwxr-xr-x 77 root root 4096 2010-04-29 21:15 ..
drwxr-xr-x 2 root root 4096 2010-04-06 13:31 .
-rwxr-xr-x 1 root root 904 2010-01-02 10:45 spamassassin
-rwxr-xr-x 1 root root 1154 2009-12-04 13:18 ntp
-rwxr-xr-x 1 root root 89 2008-10-09 13:14 logrotate
-rwxr-xr-x 1 root root 1309 2007-11-23 04:06 sysklogd
Code:
/etc$ cat cron.daily/logrotate
#!/bin/sh
test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf
Code:
cat cron.daily/sysklogd
#! /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 files manually,
# to add -a (for all log files) to syslogd-listfiles and
# add some grep stuff, or use the -s pattern argument to
# specify files that must not be listed.
#
# This is a configration file. You are invited to edit
# it and maintain it on your own. You'll have to do
# that if you don't like the default policy
# wrt. rotating logfiles (i.e. with large logfiles
# weekly and daily rotation may interfere). If you edit
# this file and don't let dpkg upgrade it, you have full
# control over it. Please read the manpage to
# syslogd-listfiles.
#
# Written by Martin Schulze <joey@debian.org>.
# $Id: cron.daily,v 1.14 2007-05-28 16:33:34 joey Exp $
test -x /usr/sbin/syslogd-listfiles || exit 0
test -x /sbin/syslogd || exit 0
test -f /usr/share/sysklogd/dummy || exit 0
USER=$(ps -C syslogd -o user= | head -n 1)
[ -z "${USER}" ] && USER="root" || true
set -e
cd /var/log
logs=$(syslogd-listfiles)
test -n "$logs" || exit 0
for LOG in $logs
do
if [ -s $LOG ]; then
savelog -g adm -m 640 -u ${USER} -c 7 $LOG >/dev/null
fi
done
# Restart syslogd
#
/etc/init.d/sysklogd reload-or-restart > /dev/null
Code:
sudo /usr/sbin/syslogd-listfiles --weekly
/var/log/mail.warn
/var/log/user.log
/var/log/daemon.log
/var/log/messages
/var/log/debug
/var/logauth.log
/var/logmail.err
/var/log/mail.log
/var/log/kern.log
/var/log/lpr.log
/var/log/mail.info
I also added this, which is the only mod I made.
Code:
cat logrotate.d/webcit
/var/log/mail.* {
weekly
missingok
rotate 7
sharedscripts
postrotate
[ ! -f /var/run/syslogd.pid ] || kill -HUP `cat /var/run/syslogd.pid`
endscript
compress
notifempty
}
Any and all help is appreciated.
So I think logrotate may work, it is possible cron is the fault?
Bookmarks