brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl -F lists every value a log field has had

Journalctl
~/tips/tip-journalctl-field-list-values

journalctl -F _SYSTEMD_UNIT

Lists all unique values of a journal field, so you know what to filter on.

I often do not know the exact unit or identifier name to filter on, and the journal can tell me.

journalctl -F _SYSTEMD_UNIT
journalctl -F SYSLOG_IDENTIFIER

-F (--field) prints each unique value of a field found in all entries of the journal. The first command lists every unit that has logged something, the second lists every program name. Then use a value as a filter, for example journalctl _SYSTEMD_UNIT=cron.service. To see the field names themselves, look at -o json-pretty output.

Further reading: journalctl manual page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link