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 --vacuum-files=5 keeps only five archived journal files

Journalctl
~/tips/tip-journalctl-vacuum-files-keep-count

sudo journalctl --vacuum-files=5

Keeps a fixed number of archived journal files and removes the oldest ones.

Size and age are the usual limits, and a file count is the third one that people forget.

--vacuum-files= leaves only the given number of separate journal files. Each file covers a period, so five files means roughly five periods of history, whatever the sizes are. You can combine it with --vacuum-size and --vacuum-time in one command.

sudo journalctl --vacuum-files=5

The result can be above the number you asked for, because active files are never removed.

Further reading: journalctl(1) 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