Skip to content
shellhacks.dev

journalctl Command Builder

Build a journalctl command that filters by unit, time range, priority, boot and text, with the output format you need and disk cleanup commands.

Free · No sign-up · Your inputs stay in your browser

Input

Build a journalctl command

Output

Command

72 characters

Disk usage and cleanup

journalctl --disk-usage sudo journalctl --vacuum-time=14d sudo journalctl --vacuum-size=1G

Make it permanent with SystemMaxUse=1G in /etc/systemd/journald.conf.

Reading the journal of other users' services needs root or membership of the systemd-journal group. The journal of a previous boot only exists when it is persistent: create /var/log/journal or set Storage=persistent in journald.conf.

Runs in this browser. Nothing you paste is sent to a server.

Filters worth knowing

-b -1 shows the previous boot, which is where the reason for a crash or an unexpected reboot is. -p err shows errors and worse. -o json writes one JSON object per line with every field for scripts, and -o cat prints just the messages. The journalctl manual lists every option.

Persistent logs

On some distributions the journal lives in memory and is lost on reboot, so -b -1 shows nothing. Creating /var/log/journal, or setting Storage=persistent in journald.conf, keeps logs across boots, and SystemMaxUse caps their size.

Share

Frequently asked questions

How do I follow a service's logs live?
journalctl -u nginx -f prints new lines as they arrive, like tail -f.
How do I free disk space used by the journal?
journalctl --vacuum-time=14d deletes entries older than 14 days, and --vacuum-size=1G trims to a size. Set SystemMaxUse to make the limit permanent.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Go deeper

Suggested reading

Keep planning

Similar tools