Bug #74469 [Com]: syslog.ident setting ignored when logging errors (error_log=syslog)
Edit report at https://bugs.php.net/bug.php?id=74469&edit=1
ID: 74469
Comment by: bartjan at pc-mania dot nl
Reported by: vedad at kajtaz dot net
Summary: syslog.ident setting ignored when logging errors
(error_log=syslog)
Status: Open
Type: Bug
Package: FPM related
Operating System: FreeBSD 10.3
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
Same issue on Centos7(.3.1611 core, 3.10.0-514.10.2.el7.x86_64) with PHP 7.0.16 (although it is from
the REMI Repo). PHP settings are default except the Timezone.
Test script (run with command /usr/bin/php test.php):
---
<?php
$ident = "%TEST%";
openlog($ident, LOG_NDELAY, LOG_LOCAL7);
syslog(LOG_INFO, 'Syslog test message!');
closelog();
---
Expected result should be:
May 3 09:28:06 server01 %TEST%[14951]: Syslog test message!
But the result however is:
May 3 09:28:06 server01 php[14951]: Syslog test message!
It does not matter how the values in de openlog() function are set, it always comes back with the
ident 'php'.
Previous Comments:
------------------------------------------------------------------------
[2017-04-18 16:49:34] vedad at kajtaz dot net
I was actually wrong - the explicit syslog() call also sends the (hardcoded?) "php-fpm"
ident to syslog.
Only administrative logs seem to hold the correct ident, eg:
2017-04-18T18:47:21.608127+02:00 ps foobar[2553]: [NOTICE] configuration file XXXX test is
successful
2017-04-18T18:47:21.645774+02:00 ps foobar[2555]: [NOTICE] fpm is running, pid 2555
2017-04-18T18:47:21.702506+02:00 ps foobar[2555]: [NOTICE] ready to handle connections
------------------------------------------------------------------------
[2017-04-18 16:42:44] vedad at kajtaz dot net
Description:
------------
The FPM setting 'syslog.ident' is ignored when PHP errors (eg. syntax errors) are being
logged to syslog (error_log = syslog).
Instead of the specified syslog.ident, "php-fpm" is always being sent to
syslog, while the explicit syslog() calls (not preceeded by an explicit openlog()) from scripts
correctly use the configured syslog.ident.
Occurs both on latest 7.0 and 7.1 releases.
Test script:
---------------
Set the following FPM setting:
error_log = syslog
syslog.ident = foobar
Start/reload FPM, invoke a script containing a syntax error.
Expected result:
----------------
2017-04-18T18:29:00.080031+02:00 ps foobar[XXX]: PHP Parse error: syntax error, unexpected
'return' (T_RETURN) in ... on line ...
Actual result:
--------------
2017-04-18T18:29:00.080031+02:00 ps php-fpm[XXX]: PHP Parse error: syntax error, unexpected
'return' (T_RETURN) in ... on line ...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74469&edit=1
Thread (3 messages)