Skip to content

Conversation

@eriklundin
Copy link
Contributor

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 patch:
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.

…es can be sent in it's raw form to the syslog.
@nikic
Copy link
Member

nikic commented Jun 17, 2019

Merged as 9f0515c into 7.3+. Thanks!

@nikic nikic closed this Jun 17, 2019
SvenRtbg added a commit to SvenRtbg/doc-en that referenced this pull request May 6, 2021
php/php-src#4265 restored the previous handling of multi-line log messages by adding `syslog.filter=raw`.
cmb69 pushed a commit to php/doc-en that referenced this pull request May 10, 2021
* Documenting the changes to syslog.filter

php/php-src#4265 restored the previous handling of multi-line log messages by adding `syslog.filter=raw`.

* Highlight the fact that line splitting is happening in all of the three original modes, but not in "raw".

* Add "raw" to syslog section of 7.3 migration guide

Closes GH-589.
mumumu added a commit to php/doc-ja that referenced this pull request May 11, 2021
* Documenting the changes to syslog.filter

php/php-src#4265 restored the previous handling of multi-line log messages by adding `syslog.filter=raw`.

* Highlight the fact that line splitting is happening in all of the three original modes, but not in "raw".

* Add "raw" to syslog section of 7.3 migration guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants