Log inSign up

Find the log line you need with journalctl filters

Run journalctl -u nginx --since "1 hour ago" to read one service, journalctl -f to follow everything live and journalctl -p err -b to list only errors since the last boot. Make history survive reboots with Storage=persistent in a journald drop-in, and cap its size with SystemMaxUse so it never fills the disk.

Topic: Monitoring and logs · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13, Rocky Linux 9, AlmaLinux 9 · Updated 2026-12-03

What is the journal and why read it with journalctl?

On Ubuntu, Debian, Rocky Linux and AlmaLinux every service started by systemd writes its output to the journal, a binary, indexed log kept by systemd-journald. Kernel messages and classic syslog calls land there too. Because entries carry fields like the unit name, PID, priority and boot ID, journalctl can filter far more precisely than grep over text files.

Some systems also keep text copies in /var/log/syslog or /var/log/messages through rsyslog, but Debian 12 and 13 rely on the journal alone by default. Learning a dozen journalctl options therefore pays off on every server you run. For logs from many machines in one place, see central logs with rsyslog.

Who is allowed to read the journal?

Root sees everything. A normal user sees only their own user services unless they belong to the systemd-journal group (or adm on Ubuntu and Debian). Add your admin user once and log in again:

sudo usermod -aG systemd-journal deploy
id deploy
journalctl --version

After that, the commands below work without sudo. If you have not created a separate admin user yet, the sudo user guide covers it.

How do I read the logs of a single service?

Pass the unit with -u. These forms cover most daily needs:

journalctl -u nginx                # whole history, oldest first
journalctl -u nginx -n 50          # last 50 lines
journalctl -u nginx -f             # follow live, Ctrl+C to stop
journalctl -u nginx -r             # newest first
journalctl -u nginx -u php8.3-fpm  # two units merged by time

The SSH daemon is a good example of distribution differences: its unit is ssh on Ubuntu and Debian and sshd on Rocky and Alma. When unsure of the name, list units with systemctl list-units --type=service, or filter by the program tag instead of the unit:

journalctl -t sshd --since today

Add -x for extra explanation text on some system messages, and --no-pager when piping the output into other commands. For your own apps, the systemd services guide shows how to run them as units so their output lands here automatically.

How do I narrow the time window and the severity?

--since and --until accept absolute times and friendly words:

journalctl --since "2026-12-03 09:00" --until "2026-12-03 09:30"
journalctl --since "20 min ago"
journalctl --since yesterday --until today

Priority filters use syslog levels from 0 (emerg) to 7 (debug). -p err shows err and anything more serious; a range like -p warning..err limits it to that band:

journalctl -p err -b
journalctl -p warning..err --since today -u postgresql

Times are shown in the server time zone. If timestamps look shifted, set the zone first with the time zone and time sync guide, or add --utc to compare with logs from other machines.

How do I look at earlier boots and kernel messages?

Each boot gets an ID. -b alone means the current boot, -b -1 the one before:

journalctl --list-boots
journalctl -b -1 -p err
journalctl -k -b          # kernel ring buffer for this boot

This is how you investigate an unexpected restart: read the last lines of the previous boot with journalctl -b -1 -n 100 and look for an out of memory kill, a disk error or a clean shutdown request. Lines containing Out of memory: Killed process mean the plan ran out of RAM; the guides on swap files and memory use help from there.

Earlier boots are only listed when the journal is stored on disk, which the next section sets up.

How do I keep logs across reboots and limit their size?

Check whether the journal already lives on disk:

ls -d /var/log/journal
journalctl --disk-usage

If the folder is missing, the journal is kept in memory under /run and vanishes at reboot. Make it persistent and set a ceiling with a drop-in file, which survives package upgrades better than editing journald.conf:

sudo mkdir -p /etc/systemd/journald.conf.d
sudo nano /etc/systemd/journald.conf.d/50-size.conf
[Journal]
Storage=persistent
SystemMaxUse=500M
SystemKeepFree=1G
MaxRetentionSec=1month
sudo systemctl restart systemd-journald
journalctl --disk-usage

SystemMaxUse caps the total, SystemKeepFree leaves room for other data, and MaxRetentionSec drops entries older than the period. To free space immediately, vacuum old files:

sudo journalctl --vacuum-size=200M
sudo journalctl --vacuum-time=14d

How do I search inside messages and export them?

Use -g (or --grep) for a pattern within the message text; it is case insensitive when the pattern is all lower case:

journalctl -u ssh -g "failed password" --since today
journalctl -b -g "timeout|refused"

Fields filter without any pattern matching, which is faster on large journals. Show which fields exist and then filter on one:

journalctl -u nginx -n 1 -o verbose
journalctl _SYSTEMD_UNIT=cron.service _PID=1234
journalctl -F _SYSTEMD_UNIT | sort | head

For tools and tickets, change the output format. -o json gives one JSON object per line, -o short-iso uses ISO timestamps, and -o cat prints only the message text:

journalctl -u myapp --since today -o short-iso --no-pager > myapp-today.log

Log shippers such as Vector can also read the journal directly and forward it, with fields preserved.

What if the journal is slow, corrupt or silent?

  • Slow queries: narrow with -u, -b and --since first; scanning months of entries with -g takes time on a small plan.
  • Corrupt files after a crash: run journalctl --verify. journald renames broken files and starts new ones, so usually no action is needed beyond a vacuum.
  • A service writes nothing: it may log to its own file instead of stdout. Check its config or /var/log, and rotate such files with logrotate.
  • Messages missing under load: journald rate limits noisy units. Raise RateLimitBurst and RateLimitIntervalSec in the drop-in if a real app needs it.
  • Permission denied: log in again after joining systemd-journal, or prefix with sudo.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
S1-2journald runs on every plan1 vCPU, 2 GB RAM, 55 GB SSD$6.00/mo$72.00 for 12 months

Questions about Read logs with journalctl

Does journalctl replace /var/log/syslog?

It covers the same messages and more. Ubuntu, Rocky and Alma still write text copies through rsyslog; Debian 12 and 13 keep only the journal unless you install rsyslog.

How much space does the journal use by default?

Without settings, journald allows up to 10 percent of the filesystem, capped at 4 GB. Check with journalctl --disk-usage and set SystemMaxUse to choose your own limit.

Can I clear the whole journal?

Use sudo journalctl --rotate followed by sudo journalctl --vacuum-time=1s. Only do this when you are sure you no longer need the history.

How do I see logs of a user service?

Add --user and run it as that user, for example journalctl --user -u myworker -f.

Where are Docker container logs?

With the default JSON file driver they are read with docker logs. If you set the journald log driver, use journalctl CONTAINER_NAME=web. Details are in Docker logs.

Why does the console graph show a spike but the journal shows nothing?

The Usage graphs tab measures resources from outside, while the journal records only what programs log. Combine both with a live view in btop or htop next time it happens.