// learn Β· linux Β· rhcsa Β· 9 min

Logs with journalctl.

systemd collects every service's output into one structured journal β€” then journalctl lets you slice it by unit, time, and priority. Learn the handful of filters that turn a wall of logs into the three lines that actually matter.

Logs with journalctl animated tutorial. The systemd journal, filtering by unit (-u), priority (-p), and time (--since/--until), following live logs (-f), listing boots (-b), and configuring a persistent journal. RHCSA EX200 ready.
// logs with journalctl

systemd funnels every service's output into one structured, queryable journal. Watch each filter narrow a wall of logs down to the lines that matter.

// before you start
you should know
  • Β·Comfortable starting/checking services with systemctl
  • Β·Helpful: the systemd targets lesson (units, services)
  • Β·Know roughly what stdout/stderr are
by the end you'll

Filter the journal by unit, priority, and time; follow logs live; inspect previous boots; and make the journal persistent.

pace: 9 minutes

journalctl β€” step 1 / 6 Β· the journal
$journalctl
09:14:02hostsshd[1201]:Accepted publickey for alice from 10.0.0.5info
09:15:33hostnginx[890]:200 GET /info
09:16:01hostnginx[890]:502 Bad Gateway /apierr
09:17:45hostkernel:usb 1-2: USB disconnectinfo
09:18:10hostsshd[1201]:Failed password for root from 198.51.100.7warning
09:20:00hostsystemd[1]:Started Daily apt timerinfo
09:21:30hostnginx[890]:500 Internal Server Error /checkouterr
09:22:15hostkernel:Out of memory: Killed process 890 (nginx)crit

The journal β€” one structured log for everything

On systemd systems, every service's stdout/stderr and every kernel message lands in ONE place: the journal. It's binary and indexed (not plain text), so you can query it by field β€” which unit, which priority, which time β€” instead of grepping scattered files. `journalctl` with no arguments prints all of it, oldest first.

$journalctl
$journalctl -e
$journalctl -n 20
// key insight

The journal is structured, not plain text. Every entry carries fields β€” unit, priority, PID, timestamp, and more β€” so journalctl filters are exact and composable. The real skill isn't reading logs, it's stacking filters: journalctl -u nginx -p err --since "1 hour ago" turns thousands of lines into the three that explain the outage.

// exam-ready Β· the journalctl flags that matter
$journalctl -u UNIT
$journalctl -p err
$journalctl --since "09:18"
$journalctl --until "10:00"
$journalctl -f
$journalctl -e
$journalctl -n 50
$journalctl -r
$journalctl -b / -b -1
$journalctl --list-boots
$journalctl -k
$journalctl _PID=1234
$journalctl -o json-pretty
$journalctl --disk-usage
$journalctl --vacuum-time=2weeks
$/etc/systemd/journald.conf
// check yourself
4 quick questions
Q1

You want to see only the logs for the nginx service. Which command?

Q2

`journalctl -p err` is running. A 'warning' message appears. Is it shown?

Q3

A server crashed and rebooted. You want the logs from BEFORE the reboot. What do you run β€” and what might prevent it from working?

Q4

You want to watch a service's logs live while you reproduce a bug. Best command?

These aren't graded β€” they're just for active recall, which is what actually makes the lesson stick.

🌳
// what produces these logs

systemd targets & units

Every line in the journal comes from a unit. Understand how systemd starts and supervises those services, and the `-u` filter suddenly makes total sense.

open β†’
// more in linux

keep going β€” these pair well with what you just learned.

see all linux β†’
back to RHCSA trackall lessons