t0xa / gelfj

Graylog Extended Log Format (GELF) implementation in Java and log4j appender without any dependencies.
https://github.com/t0xa/gelfj/wiki
Other
186 stars 116 forks source link

GelfAppender does not support JSON message parsing into additional fields #102

Closed the-james-burton closed 8 years ago

the-james-burton commented 8 years ago

When I log a JSON message to GelfAppender it does not understand JSON. I therefore get a single 'message' field in Graylog with a JSON string.

What I really wanted is for the GelfAppender to 'understand' a JSON message and populate the additional fields for me. There doesn't seem to be a way to do this, although please correct me if there is?

If not, then I think an easy way to do this is to extend GelfAppender to GalfJsonAppender and set the additional fields on append method. If you agree, I am happy to do a PR.

Regards, James

t0xa commented 8 years ago

Hi James,

Thanks a lot for your contribution. I think it's reasonable PR. I'll release version shortly.

I've also added tests for your appender. Please review it.

Anton

t0xa commented 8 years ago

v1.1.15 published. Please check.

the-james-burton commented 8 years ago

Yes, it looks good thanks, I've caught up in my fork.

I had one extra thing to go in and that was just to log out a decent error message when it cannot parse the JSON. I will do another PR for that and update the test too.

t0xa commented 8 years ago

Thanks James, Much appreciated. Waiting for PR.

the-james-burton commented 8 years ago

104