Mixing json with non-json logs

9 views
Skip to first unread message

Tony Lam

unread,
Sep 28, 2022, 4:50:42 PM9/28/22
to lnav
Hi,

Also, does lnav support reading logs with both json and non-json logs?

If yes, any example that I can take a look?

Thanks

lnav support

unread,
Sep 28, 2022, 5:05:27 PM9/28/22
to Tony Lam, lnav

Do you mean in a single file there are JSON-lines with non-JSON content?

tim

------- Original Message -------
--
You received this message because you are subscribed to the Google Groups "lnav" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lnav+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lnav/bd3459c4-206f-40e9-91b4-a76b40b17ca1n%40googlegroups.com.

Tony Lam

unread,
Sep 28, 2022, 5:12:18 PM9/28/22
to lnav
Yes, the same file has JSON-lines and non JSON-lines.

lnav support

unread,
Sep 28, 2022, 5:33:05 PM9/28/22
to Tony Lam, lnav

A mix of JSON-lines and non-JSON-lines is not really supported.  I made a
change for v0.11.1 that will cause the lines to be shown without a noisy
parser error.  However, the lines are not parsed in any meaningful way.  I
would suggest writing the different types of data to separate files.  lnav
can load them both and will interleave the messages by time when
displaying them.

tim

------- Original Message -------

Tony Lam

unread,
Sep 28, 2022, 5:41:07 PM9/28/22
to lnav

Got it.

Separately, does lnav support multiple non-JSON formats in the same file?

Thanks

lnav support

unread,
Sep 28, 2022, 7:14:29 PM9/28/22
to Tony Lam, lnav

A log file is associated with a single format.  A format can have
multiple regexes for matching lines, though.  That is mostly
useful for cases like the message formats changing between
versions of an application or an application outputting slightly
different messages.

tim

------- Original Message -------
Reply all
Reply to author
Forward
0 new messages