LinuxVIII · Logging and journaldCentral logging
Centralised logging — rsyslog forwarding and journald remote
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
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:
- Incident response: when a host is compromised or fails, the logs you need are not on that host.
- Compliance: many regulations require logs to be retained for 1+ years, often with evidence of integrity.
- 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:
$ sudo apt install rsyslog-gnutls # Debian/Ubuntu; RHEL: rsyslog-gnutls or rsyslog-opensslSetting up rsyslog-gnutls ...Illustrative output
$ cat /etc/rsyslog.d/40-central-forward.confmodule(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.
$ sudo rsyslogd -N1rsyslogd: version 8.2312.0, config validation run (level 1), master config /etc/rsyslog.conf
rsyslogd: End of config validation run. Bye.Illustrative output
$ 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
$ journalctl -u systemd-journal-upload --since 1-hour-ago --no-pagerAug 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
| Concern | rsyslog | journal-upload |
|---|---|---|
| Format | RFC 5424 syslog text | Native journal (preserves fields) |
| Filtering at source | Facility/priority rules | Full journal query language |
| Volume | Best for low-to-moderate volume | Best for moderate-to-high volume |
| Storage at SIEM | Text records | Structured records (more storage) |
| Compatibility | Universal | Newer; 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
- Configure TLS forwarding with a queue. Then default rsyslog forwarding without TLS and without a queue is unacceptable
- Test the forwarding path monthly. Send a test message; confirm the SIEM receives it
- Monitor the queue. Alert when the queue grows beyond a threshold - a SIEM outage is happening
- Forward the journal AND traditional syslog; different tools expect different formats
- Document the rotation of certificates and keys. Log forwarding is a production dependency; treat it as such
Knowledge check
Knowledge check · 5 questions
Q1. Why does production rsyslog forwarding need a queue?
Q2. journal-upload and rsyslog forwarding are the same protocol.
Q3. Which of the following are correct central-logging practices? Select all that apply.
Q4. How is TLS enabled on an rsyslog omfwd action?
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.