Linux Logs

Reading Linux System Logs With journalctl

By PlanetLogs Editorial Team · · 4 min read

On most modern Linux distributions that use systemd, the system's logs are collected by a service called the journal. Instead of scattering text files across the disk, systemd gathers messages from the kernel, services, and applications into one structured store. The tool for reading it is journalctl.

At first the output can feel overwhelming, because it shows everything at once. The real strength of journalctl is filtering. With a handful of options you can zero in on a single service, a time window or only the serious problems. This guide covers the commands you will use most often.

The Basics

Running the command with no options prints the whole journal, oldest first, through a pager:

journalctl

Use the arrow keys or page keys to move, and press q to quit. Reading from the top is rarely useful, so you will normally add options right away.

Reading the journal as a regular user may show only your own entries. To see system logs, run the command with elevated privileges using sudo, or add your user to the appropriate group such as systemd-journal or adm, depending on your distribution.

Show the Newest Entries First

To see the most recent messages at the end, jump to the bottom with journalctl -e. To reverse the order so the newest appear first, use -r:

journalctl -r

To limit how many lines appear, use -n followed by a number:

journalctl -n 50

Follow Logs in Real Time

When you are restarting a service or reproducing a bug, you want to watch messages as they arrive. The -f option works like tail -f:

journalctl -f

Press Ctrl+C to stop. You can combine it with other filters, for example to follow a single service.

Filter by Service or Unit

Most of the time you care about one service. Use -u with the unit name:

journalctl -u nginx.service
journalctl -u ssh -f

You can repeat -u to include several units. This is the single most useful filter, because it removes the unrelated noise from everything else running on the machine.

Filter by Time

Time filters let you jump to the period when a problem occurred. Use --since and --until with human-friendly values:

journalctl --since "2026-11-27 08:00" --until "2026-11-27 09:30"
journalctl --since yesterday
journalctl --since "1 hour ago"

The words today, yesterday and relative phrases like "30 minutes ago" all work. Combine these with -u to see what a service did in a specific window.

Filter by Boot

The journal can keep logs from earlier boots, if persistent storage is enabled. List the boots it knows about:

journalctl --list-boots

Then view the current boot with -b, or the previous one with -b -1:

journalctl -b
journalctl -b -1

The previous boot is especially handy when a machine crashed or restarted unexpectedly, because the events leading up to the failure are stored there.

Filter by Priority

Messages have severity levels, from emergency down to debug. Use -p to show a level and everything more severe:

journalctl -p err
journalctl -p warning -b

Common levels include emerg, alert, crit, err, warning, notice, info and debug. Starting with -p err for the current boot is a fast way to see what has gone wrong since startup.

Kernel Messages

Kernel logs, such as hardware errors and driver messages, are available with -k:

journalctl -k -b

This is a modern, filterable counterpart to the older dmesg command, and it can look back to previous boots.

Search for Text

To search within the output, use -g with a pattern:

journalctl -u myapp -g "timeout"

You can also pipe the output into grep for more control. Inside the pager, press / to search forward and n for the next match.

Choose the Output Format

By default entries are shown in a readable text form. Other formats help with scripts and analysis:

  • -o short-iso shows ISO timestamps.
  • -o json prints each entry as a JSON object.
  • -o json-pretty prints a formatted version for reading.
  • -o cat shows only the message text.

To avoid the pager, for example when sending output to a file or another command, add --no-pager.

Manage Disk Usage

The journal can grow large. Check how much space it uses:

journalctl --disk-usage

You can trim old entries by size or age with vacuum options:

sudo journalctl --vacuum-size=500M
sudo journalctl --vacuum-time=2weeks

For permanent limits, edit the journal configuration file at /etc/systemd/journald.conf and set options such as SystemMaxUse. Then restart the journal service so the change takes effect. Check the manual page for your version before editing.

Persistent Versus Volatile Storage

On some systems the journal is kept only in memory and disappears at reboot. To make it persistent, create the directory /var/log/journal and restart systemd-journald, or set Storage=persistent in the configuration file. Persistence is important if you want to investigate crashes after a restart.

A Useful Troubleshooting Routine

When a service fails to start, try this sequence:

  1. Check its state with systemctl status myservice.
  2. Read recent logs with journalctl -u myservice -n 100 --no-pager.
  3. Narrow to errors with journalctl -u myservice -p err -b.
  4. Watch live while you retry with journalctl -u myservice -f.

This short routine solves a large share of everyday problems.

Frequently Asked Questions

What is the difference between journalctl and the files in /var/log?

Traditional systems write plain text files under /var/log. The journal stores entries in a binary, indexed format that supports fast filtering by fields. Many systems keep both, with the journal data forwarded to text files by a syslog daemon. You can use whichever suits your task.

Why does journalctl show nothing or say no entries?

The usual reasons are insufficient permissions, a filter that matches nothing, or a journal that is not persistent so older logs were lost at reboot. Try running with sudo, remove filters one by one and check whether /var/log/journal exists.

Can I read the journal on a system without systemd?

No. The journal is part of systemd, so journalctl is not available on systems that use a different init system. Those systems rely on traditional log files and syslog tools, which you can search with commands such as grep and tail.

Related reading