LogViewPlus Support

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

https://www.logviewplus.com/forum/Topic1245.aspx

By klacol - 2 Dec 2021

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?
By klacol - 2 Dec 2021

I is simpler, this works:

%d{}
By LogViewPlus Support - 2 Dec 2021

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
By klacol - 2 Dec 2021

Thanks Toby, thats works; have changed it in the settings.
By LogViewPlus Support - 2 Dec 2021

Glad that helped - thanks for letting me know.

Toby