Andrew Mercer
on this page

Logs are the first place you look when something breaks and the last place you want to discover you had nothing configured. This guide covers how logging actually works on a modern Linux system, how the pieces fit together, and how to configure, ship, rotate, search and troubleshoot logs on both Debian/Ubuntu and RHEL-family (RHEL, Rocky, Alma, Fedora) systems.

Each component has its own page. Start with How Linux Logging Fits Together if you want the big picture first, or use the Quick Reference if you just need a command.

Guide

Read in order for the full picture, or jump to the component you need.

  1. How Linux Logging Fits Together — How the kernel ring buffer, systemd-journald, rsyslog, logrotate, auditd and application logs fit together on a modern Linux system, plus distribution defaults.
  2. Where Linux Logs Live — Where log files live on Debian/Ubuntu and RHEL-family systems, from syslog and auth logs to the journal and package manager logs.
  3. Syslog Fundamentals: Facilities, Severities and Formats — Syslog facilities, severity levels, PRI values and the RFC 3164 and RFC 5424 message formats.
  4. The Kernel Ring Buffer and dmesg — Reading the kernel ring buffer with dmesg and journalctl -k, and what to look for: OOM kills, disk errors, segfaults and hardware faults.
  5. systemd-journald and journalctl — Configuring systemd-journald storage and retention, and querying the journal with journalctl: filters, fields, output formats, vacuuming and access control.
  6. rsyslog — rsyslog configuration layout, legacy vs RainerScript syntax, selectors, filters, templates, high-precision timestamps and rate limiting.
  7. Remote and Centralized Logging with rsyslog — Building a central rsyslog server and forwarding clients over UDP, TCP and TLS, with rulesets, per-host files and disk-assisted queues.
  8. Generating Test Messages: logger, systemd-cat and /dev/kmsg — Generating test log messages with logger, systemd-cat and /dev/kmsg to verify routing rules, remote forwarding and alerting.
  9. Firewall Logging (nftables, iptables, firewalld, UFW) — Logging dropped packets with nftables, iptables, firewalld and UFW, and routing firewall messages to their own file with rsyslog.
  10. logrotate — Configuring logrotate: how it runs, writing and testing configs, directive reference, create vs copytruncate, and rotating custom rsyslog outputs.
  11. Login and Audit Records: wtmp, btmp, lastlog and auditd — Reading login history from wtmp, btmp and lastlog, and recording security events with the Linux audit framework (auditd, ausearch, aureport).
  12. Reading and Analyzing Logs (lnav and friends) — Reading and analyzing logs with tail, less, grep, awk and lnav, the Logfile Navigator, including lnav key bindings, filters and SQL queries.
  13. Shipping Logs to a Log Platform — Choosing a log shipper (rsyslog, Vector, Fluent Bit, Grafana Alloy, OpenTelemetry Collector, Filebeat, Logstash) and design tips for centralized logging.
  14. Logging Security, Retention and Hygiene — Log permissions, secrets, time sync, off-host shipping, retention and disk safety for Linux logging.
  15. Troubleshooting Linux Logging — Troubleshooting missing messages, remote logging failures, full disks, logrotate problems, uncompressed rotations and journal issues.
  16. Linux Logging Quick Reference — Cheat sheet of the most-used journalctl, rsyslog, logrotate, dmesg and audit commands.

Further Reading

  • man journalctl, man journald.conf, man systemd.journal-fields
  • man rsyslog.conf, and the rsyslog documentation
  • man logrotate
  • man logger, man dmesg, man auditctl, man ausearch
  • lnav documentation
  • RFC 5424 (The Syslog Protocol), RFC 5425 (TLS transport), RFC 3164 (BSD syslog)
in this section
* how linux logging fits together
* where linux logs live
* syslog fundamentals: facilities, severities and formats
* the kernel ring buffer and dmesg
* systemd-journald and journalctl
* rsyslog
* remote and centralized logging with rsyslog
* generating test messages: logger, systemd-cat and /dev/kmsg
* firewall logging (nftables, iptables, firewalld, ufw)
* logrotate
* login and audit records: wtmp, btmp, lastlog and auditd
* reading and analyzing logs (lnav and friends)
* shipping logs to a log platform
* logging security, retention and hygiene
* troubleshooting linux logging
* linux logging quick reference