journalctl: Read and Filter systemd Logs on Linux
Use journalctl to read the systemd journal: filter by unit, priority, boot and time, search messages, follow live logs and check how much disk space they use.
Contents
journalctl reads the journal that systemd collects from services, the kernel and other sources. This guide covers the filters you will use most: by unit, priority, boot and time, plus searching, following live output and checking disk usage.
Most of these commands need a running systemd with a populated journal, which a typical container does not have. Only the install step and a version check were run in test containers. The rest are shown as written in the manual page and will give different output on your machine.
Install journalctl
It ships with systemd, so any systemd-based distribution already has it. On Debian, Ubuntu and Fedora you can install the systemd package if it is missing. The Arch block below only checks that it is present.
apt-get update && apt-get install -y systemd
journalctl --versiondnf install -y systemd
journalctl --versionjournalctl --versionPermissions
By default only root and members of certain groups can read the system journal. The manual page names systemd-journal, adm and wheel. Membership in wheel often carries administrative privileges, so check what it means on your distribution before adding yourself. Otherwise prefix commands with sudo.
Read the journal
With no arguments, journalctl shows all entries in a pager. To see only the newest entries, use -n, which defaults to 10 lines when given no number. Use -r to put the newest first and --no-pager to print straight to the terminal.
journalctl -n 50 --no-pager
journalctl -rFilter by unit
-u shows messages for one unit, or for units matching a pattern. Repeat it to include several units.
journalctl -u ssh.service
journalctl -u nginx.service -u php-fpm.serviceUnit names can differ between distributions, and ssh.service here is only an example. Check the unit names on your own system before filtering.
Use --system for system services and the kernel, or --user for the current user’s services. The manual page says --user only works if persistent logging is enabled with Storage= in journald.conf.
Filter by priority
-p takes a level from 0 (emerg) to 7 (debug), by number or name. A single level includes that level and everything more important. A range FROM..TO includes both ends.
journalctl -p err
journalctl -p warning..critFilter by boot
-b selects a boot. -b alone or -b -0 means the current boot, -1 the one before it, and so on. Positive numbers count from the start of the journal. Use --list-boots to see the boots the journal knows about, with IDs and first and last timestamps.
journalctl --list-boots
journalctl -b -1 -p errPrevious boots only exist if the journal is stored on disk. See the storage section below.
-k (long form --dmesg) shows only kernel messages and implies the current boot unless you pass another -b.
Filter by time
--since and --until accept dates such as 2012-10-30 18:17:16. If you omit the time, 00:00:00 is assumed, and if you omit the date, today is assumed. The words yesterday, today, tomorrow and now work, as do relative values with a - or + prefix.
journalctl --since "2026-10-25 08:00:00" --until "2026-10-25 09:00:00"
journalctl --since yesterday -u cron.service
journalctl --since "-1h"Search messages
-g filters the MESSAGE= field with a PCRE regular expression. A pattern that is all lowercase matches case-insensitively. Add --case-sensitive to change that.
journalctl -u ssh.service -g "failed password"Follow live output
-f shows the most recent entries and keeps printing new ones until you interrupt it with Ctrl+C.
journalctl -f
journalctl -fu nginx.serviceChange the output format
-o selects the format. short is the default, short-iso uses RFC 3339 timestamps, json prints one JSON object per line, and cat prints only the message text with no metadata or timestamp.
journalctl -u ssh.service -o short-iso -n 5
journalctl -u ssh.service -o json -n 1Disk usage and cleanup
--disk-usage reports the total size of archived and active journal files. The --vacuum-size=, --vacuum-time= and --vacuum-files= options delete archived files only. Sizes take K, M, G or T suffixes (base 1024), and times default to seconds but accept units such as days or weeks. To see how much space the rest of your disk uses, read Check disk usage on Linux with df, du and ncdu.
journalctl --disk-usage
sudo journalctl --vacuum-time=2weeksPersistent storage
The manual page gives /var/log/journal/ as the persistent location. Whether logs survive a reboot depends on the Storage= setting in journald.conf. Check the journald.conf documentation for your distribution’s default before relying on -b -1.
Read a copied journal
To inspect logs from another machine or a rescued disk, point journalctl at them with -D (--directory=DIR) or -i (--file=GLOB) instead of the default paths.
Related reading
For starting, stopping and inspecting the services these logs belong to, see the systemd documentation for systemctl. For finding what is using the network, read ss Command: List Listening Ports and Connections on Linux.
Sources
This article was drafted with AI assistance, fact-checked against the sources listed above and reviewed by a human editor before publication. Spotted an error? See our corrections policy.