Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid message in manticore exception logging context #1081

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaauie
Copy link
Contributor

@yaauie yaauie commented Aug 24, 2022

When Logstash is configured to use JSON-formatted logs, the Log4j2 JSONLayout
will serialize both the provided message and the context map's message in
the same key/value collection. This is syntactically valid, because JSON
does not impose constraints on the uniqueness of keys in a key/value
collection, but considered semantically invalid by many parsers including
Beats that attempt to deserialize into a structure that do impose
uniqueness constraints.

Here we ensure that we provide the contents of the exception's message
inside a single message, without also providing a message key to the
logging context.

Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/

When Logstash is configured to use JSON-formatted logs, the Log4j2 JSONLayout
will serialize both the provided message and the context map's `message` in
the same key/value collection. This is _syntactically_ valid, because JSON
does not impose constraints on the uniqueness of keys in a key/value
collection, but considered _semantically_ invalid by many parsers including
Beats that attempt to deserialize into a structure that _do_ impose
uniqueness constraints.

Here we ensure that we provide the _contents_ of the exception's message
inside a single message, without also providing a `message` key to the
logging context.
@robbavey
Copy link
Contributor

FYI, this is a broader issue than just the elasticsearch output - elastic/logstash#14335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants