RedTeam Nexus Labs
Module 09 · Lesson 02 // Logs & System Monitoring

journal concepts

Logs & System Monitoring · Linux

Freereading · 10 min
On this page
LESSON

Overview

Most modern Linux systems use systemd and its journal for logging, accessed through journalctl. The journal is a structured, queryable log store that complements (or replaces) plain text files. This lesson explains the journal and how to query it.

Learning objectives

  • Explain what the systemd journal is.
  • Use journalctl to query logs effectively.
  • Distinguish the journal from traditional text logs.

Core concept

The systemd journal is a centralized logging system that stores log data in a structured binary format with rich metadata (timestamp, service unit, priority, PID). You query it with journalctl, which offers powerful filtering that plain text logs cannot easily match:

  • By service: journalctl -u ssh
  • By time: journalctl --since "1 hour ago"
  • Live follow: journalctl -f
  • By priority: journalctl -p err
  • Boot-scoped: journalctl -b (current boot)

How it works

Instead of scattered text files, systemd collects logs into the journal with structured fields, so you can filter precisely — for example, "errors from the SSH service in the last hour" in one command. journalctl reads this store and presents matching entries. Journals may be volatile (lost on reboot) or persistent (kept across reboots), depending on configuration. Many systems run both the journal and a traditional syslog, so entries may appear in both places.

Practical example

$ journalctl -u ssh --since "today" -p warning
Sep 21 10:16:44 host sshd[1602]: Failed password for invalid user admin from 203.0.113.9
$ journalctl -b -p err
... (errors from the current boot) ...

The first query narrows to SSH-service entries from today at warning level and above — instantly surfacing failed logins without manual grepping. The second shows error-level messages since the last boot. This targeted filtering is the journal's key advantage.

Cybersecurity relevance

journalctl's filtering makes investigation far faster: scoping by service, time window, priority, and boot lets an analyst zero in on relevant events during incident response. Understanding whether the journal is persistent matters — if it is volatile, evidence is lost on reboot, so security-conscious systems enable persistence (and often forward logs off-host). As with text logs, journal integrity is a concern; centralized/remote logging protects against local tampering. Fluency with journalctl is a practical blue-team skill.

Common mistakes

  • Trying to cat the journal — it is binary; use journalctl, not text tools directly.
  • Ignoring the journal's persistence setting, risking loss of evidence on reboot if volatile.
  • Not leveraging filters (-u, --since, -p, -b), doing slow manual searching instead.

Key takeaways

  • The systemd journal is a structured, queryable log store accessed with journalctl, complementing or replacing text logs.
  • Filter precisely by service (-u), time (--since), priority (-p), boot (-b), and follow live (-f).
  • Journals may be volatile or persistent — persistence matters for keeping evidence — and journalctl's targeted filtering speeds investigation.

Check your understanding

  • Why can't you read the journal with cat, and what tool do you use instead?
  • How would you view warning-and-above messages from the SSH service for today, and why is that faster than grepping text logs?
FINISH THIS LESSON

Sign in to save your progress.