php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76229 wrong rsyslog parameters from php-fpm logs
Submitted: 2018-04-17 12:03 UTC Modified: 2018-10-28 18:14 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: aguytech at free dot fr Assigned: bukka (profile)
Status: Closed Package: FPM related
PHP Version: 7.0.29 OS: debian9 stretch
Private report: No CVE-ID: None
 [2018-04-17 12:03 UTC] aguytech at free dot fr
Description:
------------
I catch wrong rsyslog parameters in fpm-php logs

here is wrong rsyslog parameters :

syslogtag=ool
programname=ool
app-name=ool
procid=

Test script:
---------------
Debian9 stretch
PHP 7.0.27-0+deb9u1 (cli) (built: Jan  5 2018 13:51:52) ( NTS )
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
rsyslogd 8.24.0,

"php-fpm.conf":
error_log = syslog
syslog.facility = daemon
syslog.ident = php7.0-fpm
log_level = notice

"test.php":
<?php
trigger_error("E_USER_WARNING", E_USER_WARNING);

rsyslog template:
template(name="ALL" type="string" string="%timegenerated% -HOSTNAME=%HOSTNAME% -syslogtag=%syslogtag% -programname=%programname% -syslogfacility=%syslogfacility% -syslogfacility-text=%syslogfacility-text% -syslogseverity=%syslogseverity% -syslogseverity-text=%syslogseverity-text% -syslogpriority=%syslogpriority% -syslogpriority-text=%syslogpriority-text% -inputname=%inputname% -app-name=%app-name% -procid=%procid% -msgid=%msgid% -fromhost=%fromhost% -fromhost-ip=%fromhost-ip% %msg%\n")



Expected result:
----------------
it should be better to have 'www-test[6681]' prepending message for the syslogtag parameters :

syslogtag=www-test[6681]
programname=www-test
app-name=www-test
procid=6681

At least 'pool' or 'Pool' in place of 'ool' to filter messages in syslog.

Actual result:
--------------
php-fpm log:
Apr 17 13:13:52 -HOSTNAME=debian9-php -syslogtag=ool -programname=ool -syslogfacility=3 -syslogfacility-text=daemon -syslogseverity=5 -syslogseverity-text=notice -syslogpriority=5 -syslogpriority-text=notice -inputname=imuxsock -app-name=ool -procid=- -msgid=- -fromhost=debian9-php -fromhost-ip=127.0.0.1  www-test[6681]: PHP Warning:  E_USER_WARNING in /var/www/localhost/public_html/test.php on line 2

syslogtag=ool
programname=ool
app-name=ool
procid=

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-18 11:02 UTC] aguytech at free dot fr
I think I have found the origin of problem : error_log in php.ini

test & results :

php.ini             php-fpm.conf        result
error_log=syslog    ;error_log          error in syslog
                                        + not error in apache log
error_log=syslog    error_log=/file     error in syslog
                                        + not error in apache log
error_log=syslog    error_log=syslog    error in syslog: wrong systaglog
                                        not error in apache log
error_log=/file     error_log=syslog    error in syslog: good systaglog
                                        error in apache log
;error_log          error_log=syslog    error in syslog: good systaglog
                                        error in apache log
 [2018-04-18 11:06 UTC] aguytech at free dot fr
-Type: Feature/Change Request +Type: Bug
 [2018-04-18 11:06 UTC] aguytech at free dot fr
Just changed the bug type...
 [2018-10-28 18:14 UTC] bukka@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bukka
 [2018-10-28 18:14 UTC] bukka@php.net
> error_log=syslog    error_log=syslog    error in syslog: wrong systaglog

This should be fixed in 7.3 that has got an option to set facility and ident in PHP ini. You just need to make sure that they match the ones in php-fpm conf.

The other cases are expected. If you don't want error in apache log, then you need to disable fastcgi.logging ini.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC