1

Topic: Hotfix for iRedMail-0.9.3: iRedAPD-1.7.0 cannot rotate log file

This post is used to fix log rotation error for iRedAPD-1.7.0 (it's shipped in iRedMail-0.9.3).

Issue

The latest iRedAPD-1.7.0 brings some new plugins, and some improvements, one of them is auto-rotating log file every weekend.

To auto-rotate log file, iRedAPD requires a separate directory to store log files, so our upgrade script creates /var/log/iredapd/ for this purpose, but it doesn't correctly update log file path in /opt/iredapd/settings.py, and it will raise a "permission denied" error while rotating log file.

The error message looks like below:

Dec 22 19:28:18 mail iredapd[26612]: Traceback (most recent call last):
Dec 22 19:28:18 mail iredapd[26612]: File "/usr/lib/python2.7/logging/handlers.py", line 77, in emit
Dec 22 19:28:18 mail iredapd[26612]: self.doRollover()
Dec 22 19:28:18 mail iredapd[26612]: File "/opt/iRedAPD-1.7.0/libs/logger.py", line 82, in doRollover
Dec 22 19:28:18 mail iredapd[26612]: OSError: [Errno 13] Permission denied
Dec 22 19:28:18 mail iredapd[26612]: Logged from file iredapd.py, line 105
Solution

To fix this issue, please open iRedAPD-1.7.0 config file /opt/iredapd/settings.py, change the log file from '/var/log/iredapd.log' to '/var/log/iredapd/iredapd.log', then restart iRedAPD service.

log_file = '/var/log/iredapd/iredapd.log'