-
Notifications
You must be signed in to change notification settings - Fork 264
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
Formatting JSON logs with logstash #356
Comments
You can't solve this within logbook since your appender is doing the post processing. There is nothing you can do within a custom formatter that would help. Your suggestion to use tryJson sounds like the best approach. |
@whiskeysierra @ranarula we're using a custom HttpLogWriter which logs using a Marker. The Marker extends RawJsonAppendingMarker (and autodetects pretty-printing). Essentially we're logging the request-response under a root json property 'http'. { It also formattes a message for request outline, i.e. "GET /a/b/c" which is visiable by default in our log accumulation tool (stackdriver). @whiskeysierra do you think a Logback-Logstash-module would be possible? |
@skjolber I'm open for contributions. I'm not familiar with logstash. Can you outline what you would like to put into that module? |
@skjolber - I was able to overcome the issue by annotating the logbook content with |
Basically the module will be quite small, just wrapping the request/response output as a Marker (or StructuredArgument) in a HttpLogWriter so it comes out correctly with the default library settings. |
Would you care to open a PR introducing such a module? |
Sure, I'll try to make it this week. |
Can you provide an example of this? |
@AWinterman there is JSON support now, so that approach is outdated. |
Ah gotcha. I was looking for the log stash confit to make the JSON not double serialized |
@AWinterman - did you happen to get this resolved? We are seeing the same issue. |
We have the same issue. |
Here is what we did:
|
@arjunchhabra-invitae Thanks! |
Using LogBook's
JsonHttpLogFormatter
in conjunction with composite JSON layout of logstash-logback-encoder double escapes the log, like soI am looking for suggestions to address this
One possible way I am experimenting is the use of
#tryJson{...}
in my appender pattern (as documented here),like so
Wondering if there is any other way to accomplish this
say by implementing a
CustomHttpLogFormatter
(which I initially thought but couldn't make progress) or any other wayThe text was updated successfully, but these errors were encountered: