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 --list-boots shows which boots the journal still holds

Journalctl
~/tips/tip-journalctl-list-boots-index

journalctl -b -2 -u nginx

Lists every boot the journal knows, with offsets you can pass to -b.

Before I ask for logs of an earlier boot, I check how many the journal actually kept.

journalctl --list-boots
journalctl -b -2 -u nginx

Each line shows an offset (0 is the current boot, -1 the one before), the boot ID and the time of the first and last message. Use the offset with -b, as in -b -2, or the boot ID. If only boot 0 is listed, the journal is not persistent and older boots were lost on reboot. Creating /var/log/journal or setting Storage=persistent in journald.conf keeps them from then on.

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