[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Rotating mail.log daily: a problem



On Fri, May 21, 2004 at 03:20:02PM +0200, Stephane Bortzmeyer wrote:
> I try to rotate the mail logs of a big mail server more often than the
> default (weekly).
> 
> I added this to /etc/logrotate.d :
> 
> # http://lists.debian.org/debian-devel/2003/09/msg01310.html
> # sysklogd rotates file and "weekly" is hardwired in it. We add this file 
> # to override it.
>  
> /var/log/mail.log /var/log/mail.info /var/log/mail.warn {
>         daily
>         rotate 52
>         compress
>         create 640 root adm  
>         postrotate
>               /etc/init.d/sysklogd reload
>         endscript
> }
> 
> It works but the default rotation scheme also, and it keeps rotating
> every week (syslogd-listfiles --weekly). See May 16th, a saturday :
> 
> faramir:~ % ls -alt /var/log/mail.log*
> -rw-r-----    1 root     adm       5098621 May 21 15:16 /var/log/mail.log
> -rw-r-----    1 root     adm       2912181 May 21 06:24 /var/log/mail.log.1.gz
> -rw-r-----    1 root     adm       4232280 May 20 06:24 /var/log/mail.log.2.gz
> -rw-r-----    1 root     adm       3352124 May 19 06:25 /var/log/mail.log.3.gz
> -rw-r-----    1 root     adm       2974079 May 18 06:25 /var/log/mail.log.4.gz
> -rw-r-----    1 root     adm        936179 May 17 06:25 /var/log/mail.log.5.gz
> -rw-r-----    1 root     adm          4916 May 16 06:36 /var/log/mail.log.0
> -rw-r-----    1 root     adm        386548 May 16 06:19 /var/log/mail.log.7.gz
> -rw-r-----    1 root     adm      26177210 May 15 06:15 /var/log/mail.log.8.gz
> -rw-r-----    1 root     adm       7547207 May  9 06:25 /var/log/mail.log.6.gz
> -rw-r-----    1 root     adm      38059962 Apr 25 06:38 /var/log/mail.log.9.gz
> -rw-r-----    1 root     adm      64760921 Apr 23 06:29 /var/log/mail.log.10.gz
> 
> How can I suppress the default weekly rotation (which is not managed
> by logrotate)?
> 
> Debian "sarge".

If you look in /etc/cron.daily/sysklogd you'll find where it runs those
rotates... if you add -s "mail.*" to the end of the syslogd-listfiles
command you *should* find that it will stop messing with things.

So, in summary, change:
        for LOG in `syslogd-listfiles`
to:
        for LOG in `syslogd-listfiles -s "mail.*"`
in /etc/cron.daily/sysklogd

I Hope that helps,
-- 
Brett Parker



Reply to: