1

Topic: MAILLOG ROTATION NOT working on Debian

mail log rotation not working on Debian what should I check ?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by copart 2011-01-23 03:34:50)

Re: MAILLOG ROTATION NOT working on Debian

Hi,

I have iRedMail-0.6.1 running on CentOS 5.5 and I am also seeing a maillog rotating issue.

Every night maillog is rotating and the new maillog is staying at 0 size.  If I restart the rsyslog daemon it does start to log until the next time it rotates.

3

Re: MAILLOG ROTATION NOT working on Debian

You can edit /etc/logrotate.d/maillog, change "postrotate" section to restart rsyslog.

4

Re: MAILLOG ROTATION NOT working on Debian

ZhangHuangbin wrote:

You can edit /etc/logrotate.d/maillog, change "postrotate" section to restart rsyslog.

Thanks Zhang,

I am having the same issue described above. My postrotate section is as follows:
   
postrotate
        reload rsyslog >/dev/null 2>&1 || true
endscript

What exactly are you suggesting it be changed to in order to correct this issue? Thanks in advance!

5

Re: MAILLOG ROTATION NOT working on Debian

copart wrote:

Hi,

I have iRedMail-0.6.1 running on CentOS 5.5 and I am also seeing a maillog rotating issue.

Every night maillog is rotating and the new maillog is staying at 0 size.  If I restart the rsyslog daemon it does start to log until the next time it rotates.

I'm having this same issue now, on Ubuntu.

I just added "service rsyslog restart" in the postrotate, we'll see if that's the fix or not tomorrow...

6

Re: MAILLOG ROTATION NOT working on Debian

FWIW, the fix I listed above worked for me so far so good, the mail.log was active after the rotation.

7

Re: MAILLOG ROTATION NOT working on Debian

Thanks for your sharing, blinden smile

8

Re: MAILLOG ROTATION NOT working on Debian

blinden wrote:

FWIW, the fix I listed above worked for me so far so good, the mail.log was active after the rotation.

Thank you for posting this, so if I understand your file now looks like this?:

postrotate
        service rsyslog restart
        reload rsyslog >/dev/null 2>&1 || true
endscript

Is that correct?

Thank you so much in advance!

9

Re: MAILLOG ROTATION NOT working on Debian

glacierdigital wrote:

        reload rsyslog >/dev/null 2>&1 || true

Since you have "service rsyslog restart", reload once more is not necessary. it should be:

postrotate
        service rsyslog restart
endscript

10

Re: MAILLOG ROTATION NOT working on Debian

Thanks so much!

11 (edited by glacierdigital 2011-03-06 23:45:21)

Re: MAILLOG ROTATION NOT working on Debian

This seems to be an issue still on Ubuntu 10.04.

/var/log/dovecot.log does not start logging again after:

/var/log/dovecot.log {
    compress
    weekly
    rotate 10
    create 0600 vmail vmail
    missingok

    # Use bzip2 for compress.
    compresscmd /bin/bzip2
    uncompresscmd /bin/bunzip2
    compressoptions -9
    compressext .bz2

    postrotate
       #reload rsyslog >/dev/null 2>&1 || true
       service rsyslog restart
    endscript
}

when /etc/logrotate.d/dovecot runs.

12

Re: MAILLOG ROTATION NOT working on Debian

Bump.

This is a  real issue. Every Sunday dovecot stops logging.

13

Re: MAILLOG ROTATION NOT working on Debian

And what about restarting dovecot at postrotate?

14

Re: MAILLOG ROTATION NOT working on Debian

Hi everybody !
Had the same issue on Debian, quite annoying.

However, as udi111 points out, the problem here is not to restart rsyslogd, but to restart dovecot at every logrotate. This is because dovecot is configured to log to a logfile, and not to syslog or rsyslogd or syslog-ng.
This is further complicated by the fact that in iredmail, the old logfile gets compressed with bzip2 as soon as the rotation is executed, so dovecot tries to log to a compressed file, and actually logs nowhere.

Summing up, if you have your dovecot configured to log to a file (which means in /etc/dovecot/dovecot.conf you have a line such as:

log_path = /var/log/dovecot.log

Then you need to restart dovecot, and not rsyslogd, in the logrotate file.

Since I prefer the next newer log to be left uncompressed, and I don´t really care to compress logfiles with bzip2, here is my modified /etc/logrotate.d/dovecot file:

/var/log/dovecot.log {
    compress
    # delaycompress will leave the next newest log uncompressed
    delaycompress
    weekly
    rotate 10
    create 0600 vmail vmail
    missingok

    # Use bzip2 for compress.
    #compresscmd /bin/bzip2
    #uncompresscmd /bin/bunzip2
    #compressoptions -9
    #compressext .bz2

    postrotate
        # Since dovecot is configured to log directly to a file, we
        # need to restart Dovecot here, not syslog-ng
        #invoke-rc.d syslog-ng reload > /dev/null
      /bin/kill -USR1 `cat /var/run/dovecot/master.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

iredmail developers, please fix this in the next release smile

Best regards

15

Re: MAILLOG ROTATION NOT working on Debian

Fixed. Thanks for your report. smile

(Code commit log: https://bitbucket.org/zhb/iredmail/chan … f31b20b1f3 )

16

Re: MAILLOG ROTATION NOT working on Debian

I use
/etc/init.d/dovecot restart
at postrotate, it works most of the time but sometimes it fails to restart dovecot:

/etc/cron.daily/logrotate:
Restarting IMAP/POP3 mail server: dovecotFatal: listen(0.0.0.0, 110) failed: Address already in use
failed!

in this case dovecot stops working and I have to restart it manually.