Skip to main content

Module 4: Logging and Log Management

Chapter 12: Understand Linux Logging with journald, rsyslog, and /var/log

In this chapter, you'll learn how logs move through journald and rsyslog, make the journal persistent, understand facilities and priorities, and send a service's logs to its own file.

So far, we have used the system journal in several chapters, but there is one important detail to understand: on some Linux servers, journal logs disappear after a reboot.

At the same time, when rsyslog is installed, the same message may also be written to a file under /var/log.

In this chapter, we will follow how log messages move through systemd-journald and rsyslog, make the journal persistent, and configure lab-status to write to its own log file.

What You'll Learn

  • Understand how a log message moves from a program to systemd-journald, into the journal files, and, when rsyslog is installed, into text files under /var/log.
  • Learn how syslog facilities and priorities work, send test messages with logger, and examine the fields stored by journald using journalctl -o verbose.
  • Check whether journal logs survive a reboot, then make the journal persistent and set a size limit using a journald drop-in file.
  • Examine the default rsyslog rules on Ubuntu and Rocky Linux, then create a custom rule that sends a service's messages to a separate log file.
  • Find where sudo activity is logged on each distribution and understand how long those records are kept.

How Logging Works on a Modern Linux Server

Updated on Nov 27, 2026