I'm trying to get the last few lines from
journalctl so I can feed them into my
journalctl by default provides too much crap that wastes space: With
journalctl -u PROCESS -n 5 --no-pager -l I get entries like:
DATE TIME HOSTNAME PROCESS: MESSAGE
I want to print only
TIME MESSAGE. How can I do that?
The manpage says there's an
-o argument, but there's no predefined format that fits my need. I tried adding
--output-fields=__REALTIME_TIMESTAMP,MESSAGE but that just shows the default output (and not timestamp/message). That argument claims only some formats are affected, so I tried
--output-fields=__REALTIME_TIMESTAMP,MESSAGE -o verbose but that only gives me the normal vebose output. Besides, apparently there's 4 fields that are always printed, which is already too many for me. I want just 2: a compact timestamp and the message.
I could use some bash magic or a python script to clean it up, but that seems a bit excessive. Surely there's a way to ask journalctl to give me just a timestamp and message?