1

Topic: mail.log not rotated correctly in iRedMail on Debian 11

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.5.1
- Deployed with iRedMail Easy or the downloadable installer? Downloadable
- Linux/BSD distribution name and version: Debian 11
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

I've noticed that iRedMail on Debian 11 doesn't rotate /var/log/mail.log correctly.

mail.log is rotated to mail.log.1 and mail.log is created, but postfix continues to append to mail.log.1, leaving mail.log empty.

The problem seems to be that /etc/logrotate.d/rsyslog contains, in the mail.log section:

        postrotate
                invoke-rc.d rsyslog rotate > /dev/null
        endscript

This invokes the rc.d rsyslog script that relies on syslog's PID being in /run/rsyslogd.pid.  Debian 11 (and possibly all distros that use systemd?) no longer uses this PID file.

A solution is to replace those three lines with:

        postrotate
                /usr/lib/rsyslog/rsyslog-rotate
        endscript

rsyslog-rotate is a script (provided with Debian 11 and possibly all sytemd distros) that contains:

#!/bin/sh

if [ -d /run/systemd/system ]; then
    systemctl kill -s HUP rsyslog.service
else
    invoke-rc.d rsyslog rotate > /dev/null
fi

so works whether or not systemd is being used.

----

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

2

Re: mail.log not rotated correctly in iRedMail on Debian 11

/etc/logrotate.d/rsyslog is maintained by Debian package maintainer, not iRedMail team, so it's likely you found a Debian bug. Please help report to Debian team instead:

- Visit https://packages.debian.org/bullseye/logrotate
- Found the maintainer's email on right-side bar
- Send email to the maintainer and clearly describe the issue.

Thanks. smile

3

Re: mail.log not rotated correctly in iRedMail on Debian 11

Thanks for the response.  I've just installed the latest Debian 11.2.0 in a VM and see that /etc/logrotate.d/rsyslog contains the correct "/usr/lib/rsyslog/rsyslog-rotate" as the postrotate action.

So, this looks like a bug in early versions of Debian 11 that has now been fixed.