Re: Custom JSONLayout

2020-08-14 Thread Ralph Goers
I would suggest you consider using MapMessage. The usage you are describing is why it exists. Ralph > On Aug 14, 2020, at 12:48 PM, Naz S wrote: > > No, it's not. > > We just log it as a string. > > On Fri, Aug 14, 2020 at 7:22 PM Ralph Goers > wrote: > >> Is the Message passed to the LogE

Re: Custom JSONLayout

2020-08-14 Thread Naz S
No, it's not. We just log it as a string. On Fri, Aug 14, 2020 at 7:22 PM Ralph Goers wrote: > Is the Message passed to the LogEvent a MapMessage? > > Ralph > > > On Aug 14, 2020, at 9:40 AM, Naz S wrote: > > > > Volkan, > > > > Wondering if the following case is supported by the logstash layo

Re: Custom JSONLayout

2020-08-14 Thread Ralph Goers
Is the Message passed to the LogEvent a MapMessage? Ralph > On Aug 14, 2020, at 9:40 AM, Naz S wrote: > > Volkan, > > Wondering if the following case is supported by the logstash layout: > > Let's say logEvent.getMessage() contains the message like " key1=value1 > key2=value2 someString". The

Re: Custom JSONLayout

2020-08-14 Thread Naz S
Volkan, Wondering if the following case is supported by the logstash layout: Let's say logEvent.getMessage() contains the message like " key1=value1 key2=value2 someString". Then I want to parse that message and put to json: { "timestamp" :"x", "key1" : "value1",

Re: Custom JSONLayout

2020-08-14 Thread Volkan Yazıcı
JsonTemplateLayout definitely supports access to MapMessage. Just try searching for "MapMessage" in the documentation: https://github.com/apache/logging-log4j2/blob/master/src/site/asciidoc/manual/json-template-layout.adoc On Fri, Aug 14, 2020 at 5:14 PM Ralph Goers wrote: > Volkan - Do you not

Re: Custom JSONLayout

2020-08-14 Thread Ralph Goers
Volkan - Do you not support the MapMessage? That is the standard way to handle this and is what Log4j Audit does. It uses an AuditMessage that extends MapMessage. In fact, I should be able to construct a template for AuditMessage to use with JsonTemplateLayout in Log4j-Audit. If I cannot then

Re: Custom JSONLayout

2020-08-14 Thread Volkan Yazıcı
Hello Naz, [Sorry for my late response.] I am the author of LogstashLayout and also its successor JsonTemplateLayout which will be merged into the release-2.x branch of Log4j (hopefully) in a week or two. LogstashLayout **does** support blank value elimination, you just need to set emptyProperty

Re: Custom JSONLayout

2020-08-14 Thread Naz S
So far I have looked at the logstash layout ( https://github.com/vy/log4j2-logstash-layout). It seems it doesn't work properly for my use case. Basically if I have key,value pairs I log them into the LogEvent message field, then I parse them while generating JSON objects. The key,value pairs are

Re: Custom JSONLayout

2020-08-13 Thread Naz S
Thank you for your swift response, really appreciate it. Wondering when the 2.14.0 release will come out? On Wed, Aug 12, 2020 at 4:59 PM Ralph Goers wrote: > JsonTemplateLayout hasn’t been merged to the release-2.x branch but it > will be so that it can be included in the 2.14.0 release. > >

Re: Custom JSONLayout

2020-08-12 Thread Ralph Goers
JsonTemplateLayout hasn’t been merged to the release-2.x branch but it will be so that it can be included in the 2.14.0 release. Ralph > On Aug 12, 2020, at 7:47 AM, Carter Kozak wrote: > > Hi Naz, > > Volkan has contributed a fantastic json template layout that I expect will do > what you w

Re: Custom JSONLayout

2020-08-12 Thread Carter Kozak
Hi Naz, Volkan has contributed a fantastic json template layout that I expect will do what you want, however it has not been released yet. https://github.com/apache/logging-log4j2/pull/335 This discussion from the mailing list provides several options which may be relevant to your use case: htt

Custom JSONLayout

2020-08-12 Thread Naz S
Hi, I'm trying to use JSON layout for a logging format. When I use the default JSON Layout, I see that there are some fields which are unnecessary to me (for example, loggerFqcn, endOfBatch, etc). Then I decided to implement a custom JSON layout. But I see that JacksonFactory is not visible outsi