In its current form, JsonTemplateLayout exposes the following timestamp accessors:
- timestamp -- string, formatted according to the given timestampFormatPattern) - timestamp:epoch[:divisor=<divisor>[,integral]] -- double (or long, if "integral" is provided) epoch nanoseconds divided by "divisor", if supplied. In order to support the current JsonLayout structure, JsonTemplateLayout requires a new directive: "nanos fraction of epoch seconds". I presume this is an artifact (rather than a feature) of JsonLayout, where it got while trying to serialize Instant as is via Jackson. There are two potential approaches I can think of to address this in JsonTemplateLayout: 1. Don't do it at all. (My vote goes here!) 2. Introduce a new directive for "nanos fraction of epoch seconds". This also makes me think: What if somebody would need "nanos fraction of epoch millis" or "millis fraction of epoch seconds", etc.? I've actually directed this question to @Ralph in the PR review[1], but got no replies so far. Any comments? [1] https://github.com/apache/logging-log4j2/pull/335/files#r372016555 On Tue, Jan 28, 2020 at 9:00 PM Volkan Yazıcı <volkan.yaz...@gmail.com> wrote: > > I've just created a PR[1] contributing LogstashLayout to Log4j core. > Please see the GitHub link for the feedback/support requests. I will > appreciate a quick review cycle, since I will try my best to invest > quite some time into this during FOSDEM. > > [1] https://github.com/apache/logging-log4j2/pull/335