[PATCH] Raw logging to syslog

php.internals

Erik Lundin

7 years ago
Background: In newer versions of PHP the syslog logging is forced to multiline logging and it's not possible to turn this off. This is especially problematic when you have a lot of logging and need to search and find connected lines from a single call to syslog(). For example when debugging multiline sql-queries. Test code: syslog(LOG_INFO, "test1\t\ttest2\ntest3"); Old behaviour (PHP 5.4.16 (cli) - CentOS 7): Jun 15 08:55:45 server php: test1#011#011test2#012test3 New behaviour (PHP 7.4 (dev)- CentOS 7): Jun 15 08:55:45 server php: test1\x09\x09test2 Jun 15 08:55:45 server php: test3 After patch and with configuration value (syslog.filter=raw): Jun 15 08:55:45 server php: test1#011#011test2#012test3 Suggested change: This patch includes a new configuration value for syslog.filter (raw) which allows to send the logging data in it's raw form to the syslog. The code for the other configuration values should be untouched by this change. Link to pull request: https://github.com/php/php-src/pull/4265
-- Regards, Erik Lundin