Sub topic 16
Troubleshooting Centralised Logging
Assume you are comfortable with the Linux command line, sudo, systemctl, hostnames, TCP ports, firewalls, and /var/log. Troubleshoot the pipeline in order: source, local service, network, receiver, and storage. Testing only the receiver can hide a failure on the client.
Trace one test message
Create a message with a distinctive tag on the client:
logger -t logging-test "probe $(hostname) $(date --iso-8601=seconds)"Then check the local journal:
sudo journalctl -t logging-test -n 5 --no-pagerIf the message is absent, the problem is local to the command, permissions, or the journal. If it appears locally but not centrally, continue along the forwarding path.
The following sequence shows where to look:
Check configuration and services
Validate the rsyslog configuration before restarting anything:
sudo rsyslogd -N1
sudo systemctl status rsyslog --no-pager
sudo journalctl -u rsyslog -b --no-pagerrsyslogd -N1 reads the configuration and reports syntax errors. A successful check does not prove that the destination is reachable. It only proves that rsyslog can parse its configuration.
On the client, check name resolution and the receiver's TCP port:
getent hosts loghost.example.com
nc -vz loghost.example.com 514If nc fails, inspect firewall rules on both hosts and confirm that rsyslog is listening on the receiver:
sudo ss -ltnp | grep ':514'
sudo systemctl status rsyslog --no-pagerThe receiver must listen on the same address and port that the client uses. A service bound only to 127.0.0.1 cannot accept connections from other servers.
Interpret common symptoms
| Symptom | Likely cause | Checks |
|---|---|---|
| The test is not in the client journal | Incorrect command or local journal issue | Run `logger` again and inspect `journalctl` |
| The message is local but never central | Client rule is missing or rsyslog is stopped | Run `rsyslogd -N1` and check `systemctl status rsyslog` |
| TCP connection is refused | Receiver is not listening or a firewall rejects it | Run `ss -ltnp`, inspect firewall rules |
| TCP connects but no file appears | Receiver ruleset, template, or permissions are wrong | Read rsyslog logs and inspect `/var/log/remote` |
| Files appear with unexpected names | Hostname or program name differs from your assumption | Compare `hostname --fqdn` and the message tag |
| Old files remain uncompressed | `delaycompress` postpones compression by one rotation | Inspect the next scheduled rotation |
| Logs disappear after rotation | The application still writes to the old file | Use a `postrotate` signal or restart the application safely |
Verify rotation and queues
Use debug mode before forcing a rotation:
sudo logrotate -d /etc/logrotate.d/remote
sudo logrotate -f /etc/logrotate.d/remote
sudo journalctl -u rsyslog -n 50 --no-pagerDebug mode does not change files. Forced mode does. Afterward, check that the rotated file exists and that rsyslog continues writing to the current file.
For queued forwarding, inspect rsyslog messages for queue suspension and resumption. A disk-assisted queue can preserve messages during an outage, but it cannot preserve unlimited data. Check the queue directory's free space and the configured maximum. When the receiver returns, confirm that the queue drains and that new messages arrive centrally.
A practical diagnosis
Start with one timestamped test message. Record the client hostname, tag, and time. Confirm each hop before changing configuration. This method separates syntax errors, service failures, network blocks, receiver rules, and storage problems instead of treating them as one failure.
Exercise
A test message appears in the client's journal, nc -vz loghost.example.com 514 succeeds, but no file appears under /var/log/remote. Which side should you inspect next, and what should you check?
Show answer
Inspect the receiver. Check rsyslogd -N1, the receiver's rsyslog journal, the input ruleset and dynamic-file template, and permissions on /var/log/remote.