1

Topic: Need to keep mail log for 1 month

Dear ZhangHuangbin,

Appreciate if u kindly guide me how can i keep all mail transaction log for 1 month or more. how and where to configure to get this things done. Thank u.


Best regards,
Russel

2

Re: Need to keep mail log for 1 month

russel_sc wrote:

Dear ZhangHuangbin,

Appreciate if u kindly guide me how can i keep all mail transaction log for 1 month or more. how and where to configure to get this things done. Thank u.


Best regards,
Russel

There is something strange(for me i think normally it should be stored in separate file) in iredmail and maillog rotate configs are stored in /etc/logrotate.d/syslog You have two ways to change configurations for rotation of maillog file. You can create a new file /etc/logrotate.d/maillog

/var/log/maillog {
    compress
    daily
     rotate 30
    create 0600 root root
        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
}

Remove "/var/log/maillog" from /etc/logrotate.d/syslog and  restart syslog service.

Or you can change the settings for all files stored in /etc/logrotate.d/syslog file.

3

Re: Need to keep mail log for 1 month

Dear ZhangHuangbin,

thanks for ur valued answer but can u pls make it more clear basis on the ubuntu 10.04 lts platform as i'm unable to find some files what u have mentioned above. Thanks.


Best regards,
Russel.

4

Re: Need to keep mail log for 1 month

Hi @russel_sc,

Postfix log files should be rotated by default, you can find out which logrotate config file contains it:

# grep -i 'mail.log' /etc/logrotate.d/*

Then make sure this file contains below two settings as @blade mentioned in above post:

weekly
rotate 30

For more detail, please refer to manual page:

# man logrotate

Also, Of course you can seperately rotate Postfix log files as @blade mentioned.