On this page 11 sections
  1. What journalctl does
  2. Logs for a specific service
  3. Follow logs in real time
  4. Filter by time
  5. Filter by priority
  6. Boot logs
  7. Kernel logs
  8. Filter by process
  9. Show only the message
  10. Disk usage and cleanup
  11. Practical troubleshooting workflow
01

What journalctl does

journalctl reads logs collected by systemd-journald. It provides access to service logs, kernel events, boot messages and system activity from a single interface.

Show journal
journalctl
Show recent entries first
journalctl -r
02

Logs for a specific service

The -u option filters logs by systemd unit. This is one of the most useful commands when troubleshooting a service.

SSH service logs
journalctl -u ssh
Nginx logs
journalctl -u nginx
Recent SSH logs
journalctl -u ssh -n 50
03

Follow logs in real time

-f behaves similarly to tail -f and continuously displays new events as they are written.

Follow all journal events
journalctl -f
Follow SSH events
journalctl -u ssh -f
04

Filter by time

--since and --until allow logs to be restricted to a specific time range.

Logs from today
journalctl --since today
Last hour
journalctl --since "1 hour ago"
Specific time range
journalctl --since "2026-08-18 18:00" --until "2026-08-18 20:00"
05

Filter by priority

The -p option filters messages by syslog priority. Useful values include emerg, alert, crit, err, warning, notice, info and debug.

Errors and more severe events
journalctl -p err
Warnings and above
journalctl -p warning
06

Boot logs

journalctl can separate logs by system boot. -b shows the current boot, while negative indexes inspect previous boots.

Current boot
journalctl -b
Previous boot
journalctl -b -1
List boots
journalctl --list-boots
07

Kernel logs

-k displays kernel messages recorded in the journal. This is useful for drivers, hardware, networking and filesystem problems.

Kernel logs
journalctl -k
Kernel errors
journalctl -k -p err
08

Filter by process

Logs can also be filtered by process ID, executable or other journal fields.

Logs from a PID
journalctl _PID=1234
Logs from sshd executable
journalctl _COMM=sshd
09

Show only the message

Output formats can make journalctl easier to use in scripts or pipelines.

Compact message output
journalctl -u ssh -o cat
JSON output
journalctl -u ssh -o json
10

Disk usage and cleanup

The journal can consume disk space over time. journalctl can report usage and remove older entries according to size or age.

Show journal disk usage
journalctl --disk-usage
Keep only 7 days
sudo journalctl --vacuum-time=7d
Limit journal to 500 MB
sudo journalctl --vacuum-size=500M
11

Practical troubleshooting workflow

When a service fails, first inspect its systemd status and then move into journalctl for the detailed event history.

1. Service status
systemctl status nginx
2. Recent logs
journalctl -u nginx -n 100
3. Follow while reproducing issue
journalctl -u nginx -f