Add configuration value (raw) to syslog.filter #4265
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.