<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[iRedMail — Error in php-fpm logrotate configuration]]></title>
		<link>https://forum.iredmail.org/topic20297-error-in-phpfpm-logrotate-configuration.html</link>
		<atom:link href="https://forum.iredmail.org/feed-rss-topic20297.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Error in php-fpm logrotate configuration.]]></description>
		<lastBuildDate>Mon, 26 Feb 2024 02:12:58 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Error in php-fpm logrotate configuration]]></title>
			<link>https://forum.iredmail.org/post88286.html#p88286</link>
			<description><![CDATA[<p>Would you like to help work it out? Too busy. <img src="https://forum.iredmail.org/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Mon, 26 Feb 2024 02:12:58 +0000</pubDate>
			<guid>https://forum.iredmail.org/post88286.html#p88286</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error in php-fpm logrotate configuration]]></title>
			<link>https://forum.iredmail.org/post88238.html#p88238</link>
			<description><![CDATA[<p>I don&#039;t think that fix is enough.<br />I tried putting the command<br /></p><div class="codebox"><pre><code>/usr/bin/systemctl -s HUP kill rsyslog.service &gt;/dev/null 2&gt;&amp;1 || true</code></pre></div><p>in /etc/logrotate.d/php-fpm,<br />but when running logrotate, php-fpm keeps logging into the old (now renamed) file.</p><p>From what I see, there is an inconsistency in the logging configuration of php-fpm<br />/etc/php-fpm.conf contains:<br /></p><div class="quotebox"><blockquote><p>error_log = syslog<br />syslog.facility = local5<br />syslog.ident = php-fpm</p></blockquote></div><p>while /etc/php-fpm.d/www .conf contains<br /></p><div class="quotebox"><blockquote><p>access.log = /var/log/php-fpm/php-fpm.log<br />slowlog = /var/log/php-fpm/slow.log</p></blockquote></div><p>This means that the php-fpm error log is written through syslog, while the access log is written directly to file by php-fpm. Both end up in /var/log/php-fpm/php-fpm.log.</p><p>When the log file is rotated, if only syslog is notified, syslog will log errors to the new file, while php-fpm will continue writing directly to the old file.</p><p>So either you notify both, or use the same logging mechanism for both. From what I can see, the php-fpm access log does not support syslog.</p>]]></description>
			<author><![CDATA[null@example.com (vldx-f9d863)]]></author>
			<pubDate>Mon, 12 Feb 2024 16:58:11 +0000</pubDate>
			<guid>https://forum.iredmail.org/post88238.html#p88238</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error in php-fpm logrotate configuration]]></title>
			<link>https://forum.iredmail.org/post88235.html#p88235</link>
			<description><![CDATA[<p>Fixed. Thanks for the feedback.<br /><a href="https://github.com/iredmail/iRedMail/commit/af416f4f9fc83a8d38fac967f70f21cdf327348f">https://github.com/iredmail/iRedMail/co … cdf327348f</a></p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Mon, 12 Feb 2024 15:22:38 +0000</pubDate>
			<guid>https://forum.iredmail.org/post88235.html#p88235</guid>
		</item>
		<item>
			<title><![CDATA[Error in php-fpm logrotate configuration]]></title>
			<link>https://forum.iredmail.org/post88234.html#p88234</link>
			<description><![CDATA[<p>==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====<br />- iRedMail version (check /etc/iredmail-release): 1.6.7<br />- Deployed with iRedMail Easy or the downloadable installer? Installer<br />- Linux/BSD distribution name and version: AlmaLinux 8.9<br />- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB<br />- Web server (Apache or Nginx): Nginx<br />- Manage mail accounts with iRedAdmin-Pro? No<br />- [IMPORTANT] Related original log or error message is required if you&#039;re experiencing an issue.<br />====</p><p>I&#039;m getting the following error email from anacron every week:<br /></p><div class="codebox"><pre><code>/etc/cron.daily/logrotate:

logrotate_script: line 1: PH_SYSLOG_POSTROTATE_CMD: command not found
error: error running shared postrotate script for &#039;/var/log/php-fpm/*.log &#039;</code></pre></div><p>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.</p><p>I have another server where I originally installed iRedMail 1.6.4 and manually upgraded to 1.6.7 that doesn&#039;t have this problem. The /etc/logrotate.d/php-fpm contains the following command:<br /></p><div class="codebox"><pre><code>    postrotate
        /bin/kill -SIGUSR1 `cat /run/php-fpm/php-fpm.pid 2&gt;/dev/null` 2&gt;/dev/null || true</code></pre></div><p>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.</p><p>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.<br />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).</p>]]></description>
			<author><![CDATA[null@example.com (vldx-f9d863)]]></author>
			<pubDate>Mon, 12 Feb 2024 11:27:36 +0000</pubDate>
			<guid>https://forum.iredmail.org/post88234.html#p88234</guid>
		</item>
	</channel>
</rss>
