Topic: Error in php-fpm logrotate configuration
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.7
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: AlmaLinux 8.9
- 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'm getting the following error email from anacron every week:
/etc/cron.daily/logrotate:
logrotate_script: line 1: PH_SYSLOG_POSTROTATE_CMD: command not found
error: error running shared postrotate script for '/var/log/php-fpm/*.log '
The error is in the /etc/logrotate.d/php-fpm file. The string PH_SYSLOG_POSTROTATE_CMD should have been replaced with the correct command by the iRedMail installer, but was not.
I have another server where I originally installed iRedMail 1.6.4 and manually upgraded to 1.6.7 that doesn't have this problem. The /etc/logrotate.d/php-fpm contains the following command:
postrotate
/bin/kill -SIGUSR1 `cat /run/php-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true
Running the command manually seems to work fine. I replaced the command in the configuration file, but will need to wait a week to see if it works correctly.
I looked at the installer code, and the PH_SYSLOG_POSTROTATE_CMD string is present in 5 logrotate configuration files, but the installer scripts only replace it in 4, and leave the php-fpm unchanged.
I also think that the SYSLOG_POSTROTATE_CMD used in the other 4 cases (which signals rsyslog) is probably not suitable for php-fpm, as it writes directly to the log file (instead of using the syslog service).
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.