Syslog escape forbidden characters#12079
Merged
sergepetrenko merged 4 commits intotarantool:masterfrom Dec 4, 2025
Merged
Conversation
d6d906b to
7b627ef
Compare
locker
reviewed
Nov 27, 2025
locker
approved these changes
Nov 27, 2025
xuniq
approved these changes
Dec 2, 2025
Collaborator
sergepetrenko
left a comment
There was a problem hiding this comment.
Thanks for the patch!
7b627ef to
b83ee49
Compare
b83ee49 to
b5c799d
Compare
b5c799d to
d60c721
Compare
5d1a219 to
eb404c2
Compare
This commit renames `json_escape` and `json_escape_inplace` to have more general name and allows passing escape function to them as an argument, so that the subsequent commits could introduce another type of string escaping, which will be used to make the syslog messages comply with RFC 3164. Needed for tarantool#12006 NO_TEST=refactoring NO_CHANGELOG=refactoring NO_DOC=refactoring
This commit makes logger escape prohibited characters in plain format, to make Tarantool's syslog logging comply with RFC 3164, which states: > The MSG part of the syslog packet MUST contain visible (printing) characters. The code set traditionally and most often used has also been seven-bit ASCII in an eight-bit field like that used in the PRI and HEADER parts. In this code set, the only allowable characters are the ABNF VCHAR values (%d33-126) and spaces (SP value %d32) 1. It's implemented with inplace escaping for the sake of code simplicity. Part of tarantool#12006 NO_DOC=later NO_CHANGELOG=later
This commit makes logger escape prohibited characters in JSON format, to make Tarantool's syslog logging comply with RFC 3164, which states: > The MSG part of the syslog packet MUST contain visible (printing) characters. The code set traditionally and most often used has also been seven-bit ASCII in an eight-bit field like that used in the PRI and HEADER parts. In this code set, the only allowable characters are the ABNF VCHAR values (%d33 - 126) and spaces (SP value %d32) 1. Simple `json_escape_inplace` in the end cannot be used for json escaping, as it was done for plain format, since it'll corrupt the structure of the message and it won't be possible to decode it after that. Closes tarantool#12006 @TarantoolBot document Title: Document the RFC 3164 syslog format compliance Since: 3.6.1 Documents: * https://www.tarantool.io/en/doc/latest/reference/configuration/configuration_reference/#audit-log-syslog * https://www.tarantool.io/en/doc/latest/admin/logs/#log-destination * https://www.tarantool.io/en/doc/latest/reference/reference_lua/log/ * https://www.tarantool.io/en/doc/latest/reference/configuration/#confval-log The syslog format is compliant with [RFC 3164](https://www.rfc-editor.org/rfc/rfc3164.html). However, the length of the message can be up to 16 * 1024 bytes.
The RFC 5424 expects the syslog message header to be formatted as: > <165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"] BOMAn application event log entry... Our syslog message header doesn't comply with it, users should configure syslog parser according to RFC 3164, so let's remove mention of another one from the comments. Follow-up tarantool#12006 NO_DOC=comment NO_TEST=comment NO_CHANGELOG=comment
eb404c2 to
fbd589e
Compare
Contributor
Author
|
Made some minor adjustments:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #12006