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

Re: Logging of mail events from Postfix to syslog and rotation of the mail logs



On Monday 30 January 2006 12:03 am, Simo Kauppi wrote:
> >
> > If I write my own in /etc/logrotate.d similar to exim's or another
> > service's settings, will this override the current behavior now?
>
> Hi,
>
> Yes, I believe so. The global option is 'weekly' and files in the
> /etc/logrotate.d directory override that. I.e. if postifx doesn't have
> logrotation defined anywhere else, you can just create a file in
> logrotate.d and that should do the trick.
>
> Simo

I created that script, called it postfix and tested it out and it runs but not 
the way I wanted it to.  The following is the script that I used:

/var/log/mail.* {
        daily
        missingok
        rotate 28
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
}

It works but not the way I wan it to.  Here is a list of the mail logs after 
three days:

user@foo:~$ ls -lh /var/log/mail.*
-rw-r-----  1 root adm    0 2006-02-07 03:30 /var/log/mail.err
-rw-r-----  1 root adm   88 2006-02-06 15:40 /var/log/mail.err.1
-rw-r-----  1 root adm    0 2006-02-02 08:30 /var/log/mail.info
-rw-r-----  1 root adm 1.3M 2006-02-08 09:13 /var/log/mail.log
-rw-r-----  1 root adm    0 2006-02-08 03:30 /var/log/mail.log.1
-rw-r-----  1 root adm 4.9M 2006-02-08 03:30 /var/log/mail.log.1.1
-rw-r-----  1 root adm 477K 2006-02-08 03:30 /var/log/mail.log.2.gz
-rw-r-----  1 root adm  23K 2006-02-08 09:11 /var/log/mail.warn
-rw-r-----  1 root adm    0 2006-02-08 03:30 /var/log/mail.warn.1
-rw-r-----  1 root adm  52K 2006-02-08 03:25 /var/log/mail.warn.1.1
-rw-r-----  1 root adm 7.5K 2006-02-08 03:30 /var/log/mail.warn.2.gz

Notice that it put a .1 at the end of a log already with a .1 and the 
original .1 is 0 bytes in size.  I don't know why this is happening but I 
need it to be sequential like the following:

mail.log
mail.log.0
mail.log.1.gz
mail.log.2.gz
.... etc.

Does anyone know how to do this?



Reply to: