lnav icon indicating copy to clipboard operation
lnav copied to clipboard

Support for systemd-journald logs (part of systemd)

Open np opened this issue 12 years ago • 3 comments

See http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html and http://www.freedesktop.org/software/systemd/man/journalctl.html

The journalctl command even has a json output support.

A recipe on how to do it without changing lnav would be a good start.

np avatar Nov 07 '13 08:11 np

So, it looks like there's a few options here. The default output format for journalctl seems to be syslog, so you can pipe it directly into lnav:

$ journalctl | lnav

Or, in follow mode:

$ journalctl -f | lnav

Writing a format file for lnav to consume the json version of the journalctl output would not be too difficult (see http://lnav.readthedocs.org/en/latest/formats.html#defining-a-new-format). However, the output of journalctl would have to be written to a file since I think lnav will only consume json files that match a particular file name pattern. That might be something to change in a future version.

And, I suppose, the last option is to have lnav act as a journalctl replacement. That would probably be a big undertaking and, since I don't really work on systems that use systemd, is not a high priority for me.

tstack avatar Nov 07 '13 14:11 tstack

I think these explanations should be placed on README.md because nowadays journalctl is the default log source in many systems. Not mentioning journalctl at all in "Log formats" list can disuade people to try this wonderful tool (as me if I hadn't seen this issue).

q2dg avatar Mar 02 '17 12:03 q2dg

When using sudo journalctl -o json the service peertube.service only outputs an array of decimal bytes when using the json mode. What could be the reason for this behavior? All other services like redis.service seem fine.

peertube.service peertube[6854] INFO [91,112,101,101,114,116,117, … ]
…

(I truncated the output a bit, but you get the idea.)

UnlimitedCookies avatar Sep 14 '22 18:09 UnlimitedCookies

When using sudo journalctl -o json the service peertube.service only outputs an array of decimal bytes when using the json mode. What could be the reason for this behavior?

I don't think this is related to lnav.

tstack avatar Apr 16 '24 13:04 tstack