Pattern for Parsing "2021-12-02T07:13:24.5072497Z"

Posted on Dec 2, 2021 at 7:34 AM
Hi all, I am using LogViewPlus, and it is working very well.

Now I came over a log file, that has Json entries and the date and time is provided like this:
2021-12-02T07:13:24.5072497Z

I tried to use this pattern,
%d{yyyy-MM-ddTHH:mm:ss.fffffffzzz}

but it says "Timestamp not found for log entry".

Does anybody know, how which pattern would work?
Posted on Dec 2, 2021 at 7:53 AM
I is simpler, this works:

%d{}
Posted on Dec 2, 2021 at 8:04 AM
Hi Klacol,

'Z' in a timestamp is used to indicate Zero time - or UTC-0. It is not a standard timezone and cannot be understood with the standard timezone patterns. It is actually considered a literal rather than a timezone (similar to 'T').

The correct way to parse this is with a Z:
%d{yyyy-MM-ddTHH:mm:ss.fffffffZ}


%d on it's own will also work, but this is not recommended.  %d tells LogViewPlus to 'just figure it out'.  LogViewPlus is pretty good at figuring dates out, but this approach is a little slower.  Also, it is always better to parse more accurately where possible.

Hope that helps,

Toby
Posted on Dec 2, 2021 at 8:34 AM
Thanks Toby, thats works; have changed it in the settings.
Posted on Dec 2, 2021 at 9:10 AM
Glad that helped - thanks for letting me know.

Toby

This topic is closed and cannot receive new replies.