Skip to main content
RunBook Academy

LinuxVIII · Logging and journaldCentral logging

Centralised logging — rsyslog forwarding and journald remote

Intermediate⏱ ~12 minbashrsyslogsystemd-journal-uploadopenssl

What you'll learn

  • Configure rsyslog forwarding over TLS
  • Use journald remote shipping
  • Handle SIEM outages with on-disk queues
  • Verify end-to-end delivery
  • Validate an rsyslog config with rsyslogd -N1 before reloading

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

A production host’s logs are evidence of what happened. When the host loses its disk, dies, or is compromised, the local logs are the first things to disappear. Shipping to a central store is the discipline that preserves the audit trail no matter what happens to the host.

Why central logging

Three reasons, in priority order:

  1. Incident response: when a host is compromised or fails, the logs you need are not on that host.
  2. Compliance: many regulations require logs to be retained for 1+ years, often with evidence of integrity.
  3. Correlation: a multi-host incident (a service affecting multiple users across the fleet) requires logs from every host to be queryable in one place.

The discipline is to ship every log to a central store before the host dies, with the shipping path tested regularly.

rsyslog forwarding over TLS

TLS in rsyslog is not a protocol setting. It is a netstream driver that wraps a TCP connection. You keep protocol="tcp" and add the driver parameters on top of it.

First install the driver. It ships in a separate package:

Configuration changeinstall the TLS driver
$ sudo apt install rsyslog-gnutls    # Debian/Ubuntu; RHEL: rsyslog-gnutls or rsyslog-openssl
Setting up rsyslog-gnutls ...

Illustrative output

Read-only / Safersyslog TLS forward
$ cat /etc/rsyslog.d/40-central-forward.conf
module(load="imuxsock")
module(load="imjournal")

# TLS material for the client side of the connection.
global(
DefaultNetstreamDriver="gtls"
DefaultNetstreamDriverCAFile="/etc/rsyslog.d/tls/ca.pem"
DefaultNetstreamDriverCertFile="/etc/rsyslog.d/tls/client-cert.pem"
DefaultNetstreamDriverKeyFile="/etc/rsyslog.d/tls/client-key.pem"
)

# Forward all messages to a central syslog over TLS.
action(type="omfwd"
target="siem.example.com"
port="6514"
protocol="tcp"
StreamDriver="gtls"
StreamDriverMode="1"
StreamDriverAuthMode="x509/name"
StreamDriverPermittedPeers="siem.example.com"
template="RSYSLOG_SyslogProtocol23Format"
queue.type="LinkedList"
queue.filename="central_queue"
queue.maxdiskspace="10g"
queue.saveonshutdown="on"
queue.timeoutenqueue="5"
queue.dequeuebatchsize="1000"
queue.highwatermark="90000"
queue.lowwatermark="5000"
action.resumeRetryCount="-1")

Illustrative output

Verify the forwarding path

Validate the config before reloading. rsyslogd -N1 parses every file under /etc/rsyslog.d/ and reports unknown modules and invalid parameter values without touching the running daemon.

Read-only / Safevalidate the config
$ sudo rsyslogd -N1
rsyslogd: version 8.2312.0, config validation run (level 1), master config /etc/rsyslog.conf
rsyslogd: End of config validation run. Bye.

Illustrative output

Read-only / Safetest the path
$ logger -p auth.emerg -t FORWARDING-TEST test-message; sleep 5; grep FORWARDING-TEST /var/log/rsyslog-statistics 2>/dev/null
...

Illustrative output

Handling SIEM outages

The queue settings are the buffer between rsyslog and the SIEM. If the SIEM is unreachable, rsyslog writes to the queue on disk (in /var/spool/rsyslog/). When the SIEM returns, rsyslog flushes the queue.

journald remote shipping

journald has a separate forwarding mechanism via systemd-journal-upload. Unlike rsyslog, this is journalds native protocol. It preserves structured fields.

# /etc/systemd/journal-upload.conf
[Upload]
URL=https://siem.example.com:19532
ServerKeyFile=/etc/journal-upload/siem.key
ServerCertificateFile=/etc/journal-upload/siem.crt
TrustedCertificateFile=/etc/journal-upload/ca.crt
sudo systemctl enable --now systemd-journal-upload.service
sudo systemctl status systemd-journal-upload
Read-only / Safejournal-upload status
$ journalctl -u systemd-journal-upload --since 1-hour-ago --no-pager
Aug  9 12:00:01 host systemd-journal-upload[12345]: Successfully uploaded 1024 entries in 12.345s
Aug  9 12:00:31 host systemd-journal-upload[12346]: Successfully uploaded 2048 entries in 23.456s
...

Illustrative output

Choosing between rsyslog and journal-upload

Concernrsyslogjournal-upload
FormatRFC 5424 syslog textNative journal (preserves fields)
Filtering at sourceFacility/priority rulesFull journal query language
VolumeBest for low-to-moderate volumeBest for moderate-to-high volume
Storage at SIEMText recordsStructured records (more storage)
CompatibilityUniversalNewer; requires journal-aware SIEM

For most production fleets, rsyslog over TLS to a syslog-aware SIEM is sufficient. For fleets that need structured log search, journal-upload preserves the full journal semantics.

Production discipline

  1. Configure TLS forwarding with a queue. Then default rsyslog forwarding without TLS and without a queue is unacceptable
  2. Test the forwarding path monthly. Send a test message; confirm the SIEM receives it
  3. Monitor the queue. Alert when the queue grows beyond a threshold - a SIEM outage is happening
  4. Forward the journal AND traditional syslog; different tools expect different formats
  5. Document the rotation of certificates and keys. Log forwarding is a production dependency; treat it as such

Knowledge check

Knowledge check · 5 questions

  1. Q1. Why does production rsyslog forwarding need a queue?

  2. Q2. journal-upload and rsyslog forwarding are the same protocol.

  3. Q3. Which of the following are correct central-logging practices? Select all that apply.

  4. Q4. How is TLS enabled on an rsyslog omfwd action?

  5. Q5. You roll out a forwarding config to 200 hosts. systemctl status rsyslog is active on all of them, and the SIEM shows nothing from any host. What do you check first, and why?

Passing score: 75%. Answers are checked in this browser.