The
maillog
file in /var/log
had been rotated
every night to produce maillog.1
, maillog.2
, etc.
on a CentOS Linux server. But the
log file rotation stopped at some point and the maillog
file
has been growning huge. The file contains entries related to messages
processed by sendmail on the system.
In email from the Cron Daemon to the root account, I found messages with the following within them:
/etc/cron.daily/logrotate:
error: syslog:1 duplicate log entry for /var/log/maillog
I checked /etc/logrotate.conf
, but didn't find any references
to rotation of the maillog
file there.
Contents of /etc/logrotate.conf
:
# see "man logrotate" for details
# rotate log files weekly
weekly
# 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
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
minsize 1M
create 0664 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
I then checked the /etc/logrotate.d
directory. I found
maillogrotate
there.
Contents of /etc/logrotate.d/maillogrotate
:
# Begin maillogrotate control file
/var/log/maillog {
daily
rotate 14
sharedscripts
create 0600 root root
missingok
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
# End maillogrotate control file
I also checked the /etc/logrotate.d/syslog
file, since syslog
may rotate the file.
Contents of /etc/logrotate.d/syslog
:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
So it appears that both
the /etc/logrotate.d/maillogrotate
and the
/etc/logrotate.d/syslog
files were attempting to rotate
the maillog
file on a daily basis.
Checking notes posted on my blog, I found I resolved the problem on another
email server, a Redhat Linux server, on Friday, September 17 of 2004, almost
exactly 4 years ago, and had
posted my notes in
Daily Rotation of Mail Logs. In that case, I had removed the
/var/log/maillog
reference from
/etc/logrotate.d/syslog
, so I did the same thing in this case
as well. But this time, I decided to leave the maillogrotate
file
in /etc/logrotate.d
.
Checking my notes for the CentOS email server, I see that I had in the past
removed the /var/log/maillog
reference from
/etc/logrotate.d/syslog
. Some installation or upgrade must of
led to the version of the file I created then being overwritten.
References:
-
[Rocks-Discuss] /var/log/maillog in syslog.conf vs. /var/log/mail in
logrotate.d/rocks
Date: September 13, 2006
SDSC Mailing List Server -
Pflogsumm issues
Date: July 16, 2008
HowtoForge - Linux Howtos and Tutorials -
Configuration: centos50
System Configuration Collector (SCC) -
What the hell is rotating my mail.log?
Date: February 23, 2007
Stephan Paukner -
Rotating Linux Log Files - Part 1: syslog
Date: Nisan 22, 2007
Netlojik -
Logging, Log File Rotation, and Syslog Tutorial
Wayne Pollock's Home Page -
Daily Rotation of Mail Logs
Date: September 17, 2004
MoonPoint Support