RHEL 10 Log Management: Best Practices

RHEL 10 log management: persistent journald, journalctl queries, rsyslog rules, logrotate, TLS forwarding to a collector, auditd and Ansible automation.

Aug 28, 2025 - 13:51
Nov 8, 2026 - 21:07
 0  135
TOPICDevOps BasicsPractical guide
RHEL 10 Log Management: Best Practices

Log management on RHEL 10 means deciding where logs live, how long they stay, and where copies go. The systemd journal collects events from the kernel and services, rsyslog writes text files under /var/log and forwards to remote servers, and logrotate keeps those files from filling the disk. Auditd records security events separately.

This guide is the practical companion to our RHEL 10 first-time setup guide. It covers the logging stack on a single server, then shows how to centralize logs from many servers. Firewall rules for a log server are covered in our separate RHEL 10 firewall management guide, so this post only lists the ports you need to open.

Key takeaways

  • RHEL 10 runs systemd-journald and rsyslog side by side by default. Journald captures everything; rsyslog reads the journal through its imjournal module and writes classic files such as /var/log/messages and /var/log/secure.
  • Red Hat documents that the journal is kept in volatile storage unless you make it persistent with Storage=persistent. Decide this on day one.
  • On RHEL 10 the shipped journald defaults live under /usr/lib/systemd/. Put your changes in a drop-in file under /etc/systemd/journald.conf.d/.
  • Size limits matter more than retention days. Cap the journal with SystemMaxUse and rotate rsyslog files with logrotate.
  • Send logs off the host. A compromised or crashed server cannot be trusted to keep its own evidence. Use TCP, and TLS where logs cross untrusted networks.
  • Auditd is a separate trail for security events. Do not rely on rsyslog alone for compliance evidence.

The RHEL 10 logging stack at a glance

ComponentWhat it doesWhere data livesMain config
systemd-journaldCollects kernel, boot, service stdout/stderr and syslog messages with structured metadata/run/log/journal (volatile) or /var/log/journal (persistent)Drop-ins in /etc/systemd/journald.conf.d/
rsyslogFilters messages, writes text files, forwards to remote collectors/var/log/messages, /var/log/secure, /var/log/maillog, /var/log/cron/etc/rsyslog.conf and /etc/rsyslog.d/*.conf
logrotateRotates, compresses and deletes old text log filesRotated files next to the originals/etc/logrotate.conf and /etc/logrotate.d/
auditdKernel audit trail: logins, privilege use, watched files, syscalls/var/log/audit/audit.log/etc/audit/auditd.conf, rules in /etc/audit/rules.d/

Step 1: Decide whether the journal persists

Check what you have first:

journalctl --disk-usage
ls -ld /var/log/journal /run/log/journal 2>/dev/null
journalctl --list-boots | tail -5

If --list-boots only shows the current boot, the journal is volatile. That is fine when rsyslog files and a central server hold the history. It is not fine if you want to run journalctl -b -1 after a crash to see what happened before the reboot.

To make it persistent and capped, create a drop-in instead of editing the vendor file:

sudo mkdir -p /etc/systemd/journald.conf.d
sudo tee /etc/systemd/journald.conf.d/10-persistent.conf >/dev/null <<'EOF'
[Journal]
Storage=persistent
SystemMaxUse=1G
SystemKeepFree=2G
MaxRetentionSec=30day
Compress=yes
EOF
sudo systemctl restart systemd-journald
sudo journalctl --flush

SystemMaxUse caps total journal size, SystemKeepFree leaves headroom for other data on /var, and MaxRetentionSec deletes entries older than the period. Journald applies whichever limit is hit first.

If you follow the CIS benchmark, read Red Hat's article on the journald and rsyslog overlap. The benchmark expects you to pick one primary path, and the choice affects which controls you tailor.

Step 2: Query the journal like an investigator

journalctl is faster than grepping text files because entries carry fields such as the unit, PID, priority and boot ID. These are the queries worth memorizing:

# Errors and worse since the current boot
journalctl -b -p err

# One service, last hour, follow new lines
journalctl -u sshd --since "1 hour ago" -f

# Previous boot (needs persistent storage)
journalctl -b -1 -e

# Kernel messages only
journalctl -k --since today

# Everything a given process wrote
journalctl _PID=1234

# Machine-readable output for scripts
journalctl -u nginx -o json --since "10 min ago" | head

Priorities follow syslog levels from 0 (emerg) to 7 (debug). -p warning shows warning and everything more severe. To see which fields you can filter on, run journalctl -o verbose -n 1.

Our RHEL 10 basic commands guide covers the surrounding commands such as systemctl status, which prints the last few journal lines for a unit.

What each file in /var/log holds

Text files are still what most people open first during an incident, and many third-party agents tail them. On a default RHEL 10 server you will usually find:

File or directoryContentsWritten by
/var/log/messagesGeneral system messages at info level and above, excluding mail, authpriv and cronrsyslog
/var/log/secureAuthentication and authorization: SSH logins, sudo, PAMrsyslog (authpriv facility)
/var/log/cronCron daemon activityrsyslog
/var/log/maillogMail server messages, if one is installedrsyslog
/var/log/boot.logService start messages from bootsystemd/plymouth
/var/log/dnf.log, dnf.rpm.logPackage installs, updates and removalsdnf
/var/log/audit/audit.logKernel audit eventsauditd
/var/log/httpd/, /var/log/nginx/Web server access and error logsThe web server itself
/var/log/journal/Binary journal files (when persistent)systemd-journald

Application logs written directly to files bypass both journald and rsyslog. Either point those applications at syslog or stdout, or add an rsyslog imfile input so their files reach the collector too:

# /etc/rsyslog.d/30-nginx-files.conf
module(load="imfile")
input(type="imfile" File="/var/log/nginx/error.log" Tag="nginx-error:" Severity="error")

Rate limiting: why messages go missing

Both journald and rsyslog's imjournal input rate-limit noisy sources so a runaway service cannot flood the system. If you see lines such as Suppressed N messages from myapp.service in the journal, the limit was hit. The journald settings are RateLimitIntervalSec and RateLimitBurst; you can raise them in your drop-in, or set LogRateLimitIntervalSec and LogRateLimitBurst in a specific service's unit file so only that service gets a higher allowance. Raise limits carefully. A service that logs thousands of lines per second usually needs its log level fixed, not a bigger pipe.

Retention: how long to keep logs

There is no single right number. Base retention on three things: how far back you need to look during investigations, what your auditors or regulators require, and how much storage costs. A common pattern is short local retention (one to four weeks on each server) and longer retention on the central platform, where storage is cheaper and access is controlled. Write the retention period for each log type in a short policy, apply it with journald limits, logrotate counts and the central platform's lifecycle rules, and review it yearly. If a regulation applies to you, check its text or your compliance team for the required period rather than copying a figure from a blog.

Step 3: Shape rsyslog output

The default /etc/rsyslog.conf loads imjournal and writes the familiar files. Add your own rules as separate files in /etc/rsyslog.d/ so package updates do not overwrite them. For example, to give an application its own file using RainerScript syntax:

# /etc/rsyslog.d/20-myapp.conf
if $programname == 'myapp' then {
    action(type="omfile" file="/var/log/myapp.log")
    stop
}

Validate before restarting, because a syntax error can stop rsyslog from writing anything:

sudo rsyslogd -N1
sudo systemctl restart rsyslog
logger -t myapp "test message from logger"
tail -n 2 /var/log/myapp.log

If SELinux is enforcing and you write to a non-standard directory, label it with a log type or rsyslog will be denied. Our SELinux on RHEL 10 guide explains how to read the denial with ausearch and fix the context with semanage fcontext and restorecon.

Step 4: Rotate text logs with logrotate

logrotate runs from a systemd timer (logrotate.timer) on current RHEL releases. The rsyslog package ships /etc/logrotate.d/rsyslog for the standard files. Add a file for each custom log:

# /etc/logrotate.d/myapp
/var/log/myapp.log {
    daily
    rotate 14
    compress
    delaycompress
    missingok
    notifempty
    sharedscripts
    postrotate
        /usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
    endscript
}

Test it in debug mode, which prints what would happen without touching files, then force one run:

sudo logrotate -d /etc/logrotate.d/myapp
sudo logrotate -f /etc/logrotate.d/myapp
systemctl list-timers logrotate.timer

Use copytruncate only for applications that keep the file open and cannot reopen it on a signal. It can lose a few lines written during the copy.

Step 5: Centralize logs on a collector

Pick one or two hosts as collectors. On the collector, enable a TCP listener:

# /etc/rsyslog.d/10-receive.conf (collector)
module(load="imtcp")
input(type="imtcp" port="514")

template(name="PerHost" type="string"
         string="/var/log/remote/%HOSTNAME%/%PROGRAMNAME%.log")
if $fromhost-ip != '127.0.0.1' then {
    action(type="omfile" dynaFile="PerHost")
    stop
}

Open the port in firewalld (sudo firewall-cmd --permanent --add-port=514/tcp then --reload) and allow rsyslog to bind if you choose a non-default port; the firewall details are in the firewall guide linked above.

On each client, forward with a disk-assisted queue so messages survive a collector outage:

# /etc/rsyslog.d/90-forward.conf (client)
action(type="omfwd" target="logs.example.internal" port="514" protocol="tcp"
       queue.type="LinkedList" queue.filename="fwdq"
       queue.maxDiskSpace="1g" queue.saveOnShutdown="on"
       action.resumeRetryCount="-1")

Plain TCP sends logs in clear text. When logs cross networks you do not control, use TLS. The common choice is port 6514, which IANA registers for syslog over TLS (RFC 5425). rsyslog supports TLS through its gtls or openssl network stream drivers; follow the rsyslog TLS documentation for certificate setup and test with openssl s_client before trusting it.

TransportPortReliabilityUse when
UDP syslog514/udpMessages can drop silentlyLegacy network devices that support nothing else
TCP syslog514/tcp (by convention)Delivery acknowledged at the transport layer; add a queue for outagesTrusted internal networks
Syslog over TLS6514/tcpEncrypted and authenticatedAnything crossing data centres, clouds or the internet

Many teams forward from the collector into a search platform such as Elasticsearch or OpenSearch, Grafana Loki or a SaaS tool. Our real-time logging tools roundup and the feature table in 20 DevOps logging tools compared help you pick one.

Step 6: Keep an audit trail with auditd

Auditd records events the kernel sees, independent of what applications choose to log. It is installed and enabled on default RHEL server installs. Add rules as files in /etc/audit/rules.d/, then load them:

# Watch changes to sudo configuration
echo '-w /etc/sudoers -p wa -k sudoers_change' | sudo tee /etc/audit/rules.d/50-sudoers.rules
echo '-w /etc/sudoers.d/ -p wa -k sudoers_change' | sudo tee -a /etc/audit/rules.d/50-sudoers.rules
sudo augenrules --load

# Search and summarize
sudo ausearch -k sudoers_change -i
sudo aureport --login --summary

Combine this with the SSH hardening in our RHEL 10 SSH keys and security guide: failed SSH logins land in /var/log/secure and the journal, while auditd records the login sessions themselves.

Step 7: Automate the configuration

Hand-editing logging on fifty servers drifts quickly. RHEL ships RHEL System Roles, including a logging role, in the rhel-system-roles package. A minimal playbook that forwards logs from clients looks like this; check the role README under /usr/share/doc/rhel-system-roles/logging/ for the full variable list on your version:

- name: Forward logs to the central collector
  hosts: rhel10_servers
  become: true
  vars:
    logging_inputs:
      - name: system_input
        type: basics
    logging_outputs:
      - name: central
        type: forwards
        target: logs.example.internal
        tcp_port: 514
    logging_flows:
      - name: to_central
        inputs: [system_input]
        outputs: [central]
  roles:
    - rhel-system-roles.logging

Keep the playbook in Git and review changes through merge requests so every logging change has an author and a reason.

Day-two checks

CheckCommandHealthy result
Journal sizejournalctl --disk-usageBelow your SystemMaxUse
Journal integrityjournalctl --verifyPASS for each file
rsyslog configrsyslogd -N1No errors
Forwarding workslogger -p user.warning "fwd test" then search on collectorMessage appears within seconds
Disk on /vardf -h /var /var/logComfortable free space; ideally /var/log on its own filesystem
Rotation ranls -lh /var/log/messages*Dated, compressed older files

For CPU, memory and disk metrics beside the logs, see how to monitor system performance in RHEL 10.

Common mistakes

  • Leaving the journal volatile and then needing logs from before a crash.
  • No size cap, so a chatty service fills /var and other services fail.
  • Editing /etc/rsyslog.conf directly and losing changes during an upgrade review.
  • Forwarding over UDP and assuming every message arrived.
  • Logging secrets. Mask tokens and passwords in the application before they reach syslog.
  • Clocks out of sync. Enable chronyd on every host so timestamps line up across servers.

Frequently asked questions

Does RHEL 10 still use rsyslog?

Yes. RHEL 10 runs systemd-journald and rsyslog together by default. Journald collects events, and rsyslog reads them through imjournal to write text files under /var/log and forward to remote servers.

How do I make journald logs survive a reboot on RHEL 10?

Set Storage=persistent in a drop-in file under /etc/systemd/journald.conf.d/, restart systemd-journald and run journalctl --flush. Add SystemMaxUse so the journal cannot grow without limit.

Where are the main log files on RHEL 10?

General messages go to /var/log/messages, authentication to /var/log/secure, cron to /var/log/cron, mail to /var/log/maillog and audit events to /var/log/audit/audit.log. The journal lives in /var/log/journal when persistent.

How do I see logs from the previous boot?

Run journalctl -b -1. It only works if the journal is persistent, because a volatile journal is cleared at reboot. journalctl --list-boots shows which boots are available.

Which port should I use for remote syslog?

Use TCP 514 on trusted internal networks and TCP 6514 with TLS, as registered by IANA for syslog over TLS in RFC 5425, when logs cross networks you do not control. Avoid UDP where loss matters.

How often does logrotate run on RHEL 10?

logrotate is triggered by logrotate.timer, which runs daily by default. Each file in /etc/logrotate.d/ sets its own schedule, retention count and compression. Test changes with logrotate -d.

Is journald or auditd better for security logging?

Use both. Journald and rsyslog record what services report. Auditd records kernel-level events such as file changes and privilege use, which is what auditors usually ask for.

Learn it hands-on

Logging, journald, SELinux and service management are core tasks in Red Hat system administration. Our RHCSA training covers them on RHEL in the Kharadi, Pune classroom and live online, and the Linux administration course goes further into day-to-day operations.

References

Interested in learning more?Get a callback from our training advisors.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.