[PHP-BUG] Req #52052 [NEW]: add syslog support to FPM
From: Operating system: Linux/*NIX PHP version: 5.3SVN-2010-06-11 (SVN) Package: FPM related Bug Type: Feature/Change Request Bug description:add syslog support to FPM Description: At current, FPM only allows logging to local files, both for the ErrorLog and SlowLog. Using syslog aids the administrator greatly in centralizing logfiles. Also PHP itself has syslog support, so FPM should consequently have it, too. I hereby ask to add syslog support to FPM. -- Edit bug report at http://bugs.php.net/bug.php?id=52052&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52052&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52052&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52052&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52052&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52052&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52052&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52052&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52052&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52052&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52052&r=support Expected behavior: http://bugs.php.net/fix.php?id=52052&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52052&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52052&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52052&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52052&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=52052&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52052&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52052&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52052&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52052&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52052&r=mysqlcfg
Req #52052 [Asn]: add syslog support to FPM
Edit report at http://bugs.php.net/bug.php?id=52052&edit=1 ID: 52052 User updated by: ef-lists at email dot de Reported by: ef-lists at email dot de Summary: add syslog support to FPM Status: Assigned Type: Feature/Change Request Package: FPM related Operating System: Linux/*NIX PHP Version: 5.3SVN-2010-06-11 (SVN) Assigned To: fat New Comment: Great job! :-) I'll try it out and report feedback to you. Previous Comments: [2010-06-12 18:49:35] f...@php.net The attached patch should activate syslog sypport to error_log only. You can try it on trunk. change error_log to "syslog" You can also set syslog_facility and syslog_ident to feet your needs. But default values should be OK. I'm working on the slowlog patch also but it's a bit more complicated. ++ Jerome [2010-06-12 18:47:15] f...@php.net The following patch has been added/updated: Patch Name: fpm-syslog.v1.patch Revision: 1276361235 URL: http://bugs.php.net/patch-display.php?bug=52052&patch=fpm-syslog.v1.patch&revision=1276361235 ------------ [2010-06-11 18:10:10] ef-lists at email dot de Description: At current, FPM only allows logging to local files, both for the ErrorLog and SlowLog. Using syslog aids the administrator greatly in centralizing logfiles. Also PHP itself has syslog support, so FPM should consequently have it, too. I hereby ask to add syslog support to FPM. -- Edit this bug report at http://bugs.php.net/bug.php?id=52052&edit=1
Req #52052 [Asn]: add syslog support to FPM
Edit report at http://bugs.php.net/bug.php?id=52052&edit=1 ID: 52052 User updated by: ef-lists at email dot de Reported by: ef-lists at email dot de Summary: add syslog support to FPM Status: Assigned Type: Feature/Change Request Package: FPM related Operating System: Linux/*NIX PHP Version: 5.3SVN-2010-06-11 (SVN) Assigned To: fat New Comment: Sorry it took me so long to reply. Too much work and too few spare time. Netherless I reviewed the patch and fixed some problems. If trace failed in fpm_php_trace.c:fpm_php_trace, there was a call to fwrite with a NULL pointer. Added syslog here. In fpm_stdio.c:fpm_stdio_init_child a close was performed on the fd set to ZLOG_SYSLOG. (valgrind complained) In fpm_stio.c:fpm_stdio_open_error_log, the variable syslog shadowed syslog() - renamed it to syslog_opened. It didn't matter from the code's point of view, but I think shadowing is a bad thing and renaming avoids it and also doesn't emit a warning, if you compile with -Wshadow. In php-fpm.conf.in was a typo (syslog_syslog_level -> slowlog_syslog_level). Four more questions regarding the patch: 1) Is there a particular reason, why the facility names are partially compared with strcasecmp and strcmp? I found it confusing, that I have to type LOCAL6 instead of local6. 2) When looking at php_syslog.h - for maximum portability, shouldn't the syslog() calls be changed to php_syslog()? 3) I'm unsure - but aren't we losing messages from libevent written to stderr in the master process? I think one could use the fpm event system, to catch stderr, but didn't investigate further yet. 4) Are you planning to integrate this patch into SVN? Oh and besides the issues I mentioned - the patch works fine for me. :-) Regards, Edgar Previous Comments: [2010-06-13 11:03:33] f...@php.net my mistakes. The v2 patch was buggy. Use v3 instead. [2010-06-13 11:03:00] f...@php.net The following patch has been added/updated: Patch Name: fpm-syslog.v3.patch Revision: 1276419780 URL: http://bugs.php.net/patch-display.php?bug=52052&patch=fpm-syslog.v3.patch&revision=1276419780 [2010-06-13 10:41:26] f...@php.net You can try instead the new revision of the patch I've just attached. It adds sending slowlog to syslog. Set slowlog to syslog. Moreover you can set slowlog_syslog_level to same values as log_level. By default it's LOG_DEBUG. There is no way to change the ident and the facility for slowlog, it takes the same values as the globals ones (syslog_facility and syslog_event). There is no need to because the pool name is prepended to every slowlog message. [2010-06-13 10:36:27] f...@php.net The following patch has been added/updated: Patch Name: fpm-syslog.v2.patch Revision: 1276418186 URL: http://bugs.php.net/patch-display.php?bug=52052&patch=fpm-syslog.v2.patch&revision=1276418186 -------------------- [2010-06-12 19:54:05] ef-lists at email dot de Great job! :-) I'll try it out and report feedback to you. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52052 -- Edit this bug report at http://bugs.php.net/bug.php?id=52052&edit=1
Req #52052 [Com]: add syslog support to FPM
Edit report at http://bugs.php.net/bug.php?id=52052&edit=1 ID: 52052 Comment by: ef-lists at email dot de Reported by: ef-lists at email dot de Summary:add syslog support to FPM Status: Assigned Type: Feature/Change Request Package:FPM related Operating System: Linux/*NIX PHP Version:5.3SVN-2010-06-11 (SVN) Assigned To:fat Block user comment: N Private report: N New Comment: Hi Jerome, are there any updates on this issue yet? With PHP 5.3.4 and PHP 5.3.5 the latest patch doesn't work anymore. I'd be willing to port it to the latest release, if you're interested. I'd still like to see this integrated into trunk and 5.3.X. Regards, Edgar Previous Comments: [2010-07-22 23:37:45] f...@php.net some answers to your questions: 1- this is a bug. All comparaison should use strcasecmp so that users can type facilities and log level with the case they want. 2- you're right. php_syslog() should be used instead of syslog() 4- after testing and validating, yes of course. I need to take time reviewing all this. Thx again ! [2010-07-07 13:17:07] f...@php.net Thanks for the reporting. I'll check that and answer you as soon as possible. -------- [2010-07-07 12:27:54] ef-lists at email dot de Sorry it took me so long to reply. Too much work and too few spare time. Netherless I reviewed the patch and fixed some problems. If trace failed in fpm_php_trace.c:fpm_php_trace, there was a call to fwrite with a NULL pointer. Added syslog here. In fpm_stdio.c:fpm_stdio_init_child a close was performed on the fd set to ZLOG_SYSLOG. (valgrind complained) In fpm_stio.c:fpm_stdio_open_error_log, the variable syslog shadowed syslog() - renamed it to syslog_opened. It didn't matter from the code's point of view, but I think shadowing is a bad thing and renaming avoids it and also doesn't emit a warning, if you compile with -Wshadow. In php-fpm.conf.in was a typo (syslog_syslog_level -> slowlog_syslog_level). Four more questions regarding the patch: 1) Is there a particular reason, why the facility names are partially compared with strcasecmp and strcmp? I found it confusing, that I have to type LOCAL6 instead of local6. 2) When looking at php_syslog.h - for maximum portability, shouldn't the syslog() calls be changed to php_syslog()? 3) I'm unsure - but aren't we losing messages from libevent written to stderr in the master process? I think one could use the fpm event system, to catch stderr, but didn't investigate further yet. 4) Are you planning to integrate this patch into SVN? Oh and besides the issues I mentioned - the patch works fine for me. :-) Regards, Edgar [2010-06-13 11:03:33] f...@php.net my mistakes. The v2 patch was buggy. Use v3 instead. [2010-06-13 11:03:00] f...@php.net The following patch has been added/updated: Patch Name: fpm-syslog.v3.patch Revision: 1276419780 URL: http://bugs.php.net/patch-display.php?bug=52052&patch=fpm-syslog.v3.patch&revision=1276419780 The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52052 -- Edit this bug report at http://bugs.php.net/bug.php?id=52052&edit=1
Req #52052 [Asn]: add syslog support to FPM
Edit report at http://bugs.php.net/bug.php?id=52052&edit=1 ID: 52052 User updated by: ef-lists at email dot de Reported by: ef-lists at email dot de Summary:add syslog support to FPM Status: Assigned Type: Feature/Change Request Package:FPM related Operating System: Linux/*NIX PHP Version:5.3SVN-2010-06-11 (SVN) Assigned To:fat Block user comment: N Private report: N New Comment: Hi, added a new patch, which can be applied to a vanilla PHP 5.3.5. compiles and runs with: --enable-debug without relevant warnings --enable-maintainer-zts without other flags with having HAVE_SYSLOG_H in main/php_config.h undefined changes: * modified patch to work with FPM in 5.3.5 * added new parameters to config dump (todo: translate syslog prio and facility to nice human-readable values) * made comparing syslog facilities case-insensitive * replaced syslog() calls with php_syslog() Regards, Edgar Previous Comments: [2011-01-12 16:15:58] ef-lists at email dot de Hi Jerome, are there any updates on this issue yet? With PHP 5.3.4 and PHP 5.3.5 the latest patch doesn't work anymore. I'd be willing to port it to the latest release, if you're interested. I'd still like to see this integrated into trunk and 5.3.X. Regards, Edgar [2010-07-22 23:37:45] f...@php.net some answers to your questions: 1- this is a bug. All comparaison should use strcasecmp so that users can type facilities and log level with the case they want. 2- you're right. php_syslog() should be used instead of syslog() 4- after testing and validating, yes of course. I need to take time reviewing all this. Thx again ! [2010-07-07 13:17:07] f...@php.net Thanks for the reporting. I'll check that and answer you as soon as possible. -------- [2010-07-07 12:27:54] ef-lists at email dot de Sorry it took me so long to reply. Too much work and too few spare time. Netherless I reviewed the patch and fixed some problems. If trace failed in fpm_php_trace.c:fpm_php_trace, there was a call to fwrite with a NULL pointer. Added syslog here. In fpm_stdio.c:fpm_stdio_init_child a close was performed on the fd set to ZLOG_SYSLOG. (valgrind complained) In fpm_stio.c:fpm_stdio_open_error_log, the variable syslog shadowed syslog() - renamed it to syslog_opened. It didn't matter from the code's point of view, but I think shadowing is a bad thing and renaming avoids it and also doesn't emit a warning, if you compile with -Wshadow. In php-fpm.conf.in was a typo (syslog_syslog_level -> slowlog_syslog_level). Four more questions regarding the patch: 1) Is there a particular reason, why the facility names are partially compared with strcasecmp and strcmp? I found it confusing, that I have to type LOCAL6 instead of local6. 2) When looking at php_syslog.h - for maximum portability, shouldn't the syslog() calls be changed to php_syslog()? 3) I'm unsure - but aren't we losing messages from libevent written to stderr in the master process? I think one could use the fpm event system, to catch stderr, but didn't investigate further yet. 4) Are you planning to integrate this patch into SVN? Oh and besides the issues I mentioned - the patch works fine for me. :-) Regards, Edgar [2010-06-13 11:03:33] f...@php.net my mistakes. The v2 patch was buggy. Use v3 instead. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52052 -- Edit this bug report at http://bugs.php.net/bug.php?id=52052&edit=1
Req #52052 [Asn]: add syslog support to FPM
Edit report at http://bugs.php.net/bug.php?id=52052&edit=1 ID: 52052 User updated by: ef-lists at email dot de Reported by: ef-lists at email dot de Summary:add syslog support to FPM Status: Assigned Type: Feature/Change Request Package:FPM related Operating System: Linux/*NIX PHP Version:5.3SVN-2010-06-11 (SVN) Assigned To:fat Block user comment: N Private report: N New Comment: Oh you're right. We're actually experiencing this issue here. At least the master process should always log to the configured ident/facility - that's configuration and process manager warnings/errors. By far the most important log output from FPM, IMHO. I don't think this is a critical issue for FPM, as log output is never discarded and other sapis (milter, thttpd, mod_php with Apache ErrorLog set to syslog) do it the same way - although it would be nice to see this resolved. I still wonder how to properly do this... open a separate socket and mimic syslog behaviour? How to address this on Windows? If you have updates, I'd be really curious. If I can help, let me know. :-) Previous Comments: [2011-01-29 15:46:44] f...@php.net thx for the up to date patch. But there is still a remaining problem: php_syslog(), openlog() and closelog() can be called from FPM code, core code, user script, module, sapi, ... If two calls to openlog() are made from two different places. Then this is not sure than php_syslog() will log the right ident and facility. This a global reflection to make around PHP and not only in FPM. I'm working on it. -------- [2011-01-28 15:53:44] ef-lists at email dot de Hi, added a new patch, which can be applied to a vanilla PHP 5.3.5. compiles and runs with: --enable-debug without relevant warnings --enable-maintainer-zts without other flags with having HAVE_SYSLOG_H in main/php_config.h undefined changes: * modified patch to work with FPM in 5.3.5 * added new parameters to config dump (todo: translate syslog prio and facility to nice human-readable values) * made comparing syslog facilities case-insensitive * replaced syslog() calls with php_syslog() Regards, Edgar -------- [2011-01-12 16:15:58] ef-lists at email dot de Hi Jerome, are there any updates on this issue yet? With PHP 5.3.4 and PHP 5.3.5 the latest patch doesn't work anymore. I'd be willing to port it to the latest release, if you're interested. I'd still like to see this integrated into trunk and 5.3.X. Regards, Edgar [2010-07-22 23:37:45] f...@php.net some answers to your questions: 1- this is a bug. All comparaison should use strcasecmp so that users can type facilities and log level with the case they want. 2- you're right. php_syslog() should be used instead of syslog() 4- after testing and validating, yes of course. I need to take time reviewing all this. Thx again ! [2010-07-07 13:17:07] f...@php.net Thanks for the reporting. I'll check that and answer you as soon as possible. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52052 -- Edit this bug report at http://bugs.php.net/bug.php?id=52052&edit=1