json: accept more characters in extract-prefix
for json-parser()
#371
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.
When receiving JSON objects whose keys have
@
or-
characters, it iscurrently not possible to extract them with
extract-prefix
since theyare not considered as a valid JS identifier.
In JS, bracket notation should be used instead when accessing such
properties. This is not implemented in syslog-ng as only array indices
can be accessed with this notation.
This commit extends the set of supported characters to
@
and-
.-
can be easily found in the wild while
@
is part of the event logformat of Logstash (
@version
and@timestamp
).This commit could be extended to support
$
(which is a valid characterin a JS identifier) but this may conflict with variable expansion. Any
character other than
[
and.
could be accepted as they don't have ameaning in the dot notation.
This PR can also be applied on previous versions of syslog-ng (at least 3.6).