Including file name in log line?

11 views
Skip to first unread message

Tony Lam

unread,
Oct 3, 2022, 2:14:18 PM10/3/22
to lnav

Now I got several custom log formats (mostly JSON) working, I'd like to view the file source in logs with multiple log files, I know the file name is shown on top for the current log, but it's not easy to see how logs are generated from multiple files in a glance, I ended up adding a string literal in the log format to indicate the file name (see screenshot below), but what really will be useful is to have "file_source" in the format definition that maps to a literal string base on one or more regex, and have it highlighted, something like:

  "file_source": [ {"^abc": "FileABC"}, {"def.json$", "DEF"}]

Let me know if there is a better way to do this.

thanks



lnav-file-source.jpg

lnav support

unread,
Oct 3, 2022, 3:45:53 PM10/3/22
to lnav

Press the left arrow key to reveal the source file name. Press
again to reveal the full path. See:


Tim

--
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/0e99bcf7-67e2-4899-a4f8-f05666c94d78n%40googlegroups.com.

Tony Lam

unread,
Oct 3, 2022, 4:30:26 PM10/3/22
to lnav
Yes, this works, I might be nit-picking here, but mapping to a short name also saves screen real estate which is scarce for long log lines or logs with many fields, we may have an option to only turn it on for logs from multiple files.

thanks

Reply all
Reply to author
Forward
0 new messages