← Rules Catalog
mediumloggingverified

Ensure only one logging system is in use

single-logging-system · RHEL ≥ 9 · 1 impl

Description

Only one primary logging system should be in use (either journald-only or journald with rsyslog) to avoid confusion and ensure log integrity.

Rationale

Having a clear logging strategy ensures logs are properly collected, stored, and available for security analysis.

Check → Remediate

Checkcommand
# Check journald is running (required)
if ! systemctl is-active systemd-journald >/dev/null 2>&1; then
  echo "FAIL: systemd-journald is not active"
  exit 1
fi

# Check if rsyslog is in use
rsyslog_active=false
systemctl is-active rsyslog >/dev/null 2>&1 && rsyslog_active=true

# If rsyslog is active, ensure journald forwards to it
if $rsyslog_active; then
  forward=$(systemd-analyze cat-config systemd/journald.conf 2>/dev/null | grep -E '^ForwardToSyslog=' | tail -1 | cut -d= -f2)
  if [ "$forward" = "yes" ]; then
    echo "OK: journald + rsyslog (with forwarding)"
    exit 0
  fi
  echo "INFO: journald + rsyslog (forwarding not configured)"
  exit 0
fi

echo "OK: journald-only logging"
exit 0
expected_exit:
0
Remediatemanual
note:
Ensure systemd-journald is active. If using rsyslog, configure ForwardToSyslog=yes

Framework references

CIS

rhel9 6.2.1.4rhel10 6.2.1.4

NIST 800-53

AU-4AU-12

Live verification

rhel10:checkrhel9:check
#journald#rsyslog#logging#security