Debian GNU/Linux · Logging & auditing

Forward the journal to rsyslog only when rsyslog is the chosen logger

When it fails: The journal forwarding setting does not match the logging system in use. Messages are either sent to a syslog daemon that does not exist, or not given to the rsyslog daemon that is supposed to store and forward them.

CB-DEB-AUDIT-002lowactiveautomatedautomated fixprofile core

As released in v0.1.1 beta · pre-release. Current state.

Description

A Debian system should use one logging system: the systemd journal alone, or the journal feeding rsyslog, which then writes text files and forwards messages. The journald setting ForwardToSyslog= decides whether each message is also handed to a syslog daemon.

  • When the rsyslog package is installed, ForwardToSyslog=yes is required, so that rsyslog receives every message.
  • When it is not installed, ForwardToSyslog=no is required, since nothing reads the forwarded messages.

Debian 13 ships /usr/lib/systemd/journald.conf.d/syslog.conf with ForwardToSyslog=yes, even when no syslog daemon is installed. The fix writes /etc/systemd/journald.conf.d/syslog.conf, which replaces that vendor file. On Debian 12 the default is no.

Rationale

A mismatch either loses messages in the files and remote copies managed by rsyslog, or wastes resources on a socket nobody reads. Choosing one system keeps the log pipeline simple to review.

Impact

None known. The journal keeps every message in both cases.

Setting

Location/etc/systemd/journald.conf.d/syslog.conf
DefaultDebian 12: no; Debian 13: yes
Recommendedyes when rsyslog is installed, no otherwise

Audit

  1. Run dpkg-query -W -f='${Status}\n' rsyslog to know whether rsyslog is installed.
  2. Run systemd-analyze cat-config systemd/journald.conf. The last ForwardToSyslog= must be yes if rsyslog is installed, and no (or absent) otherwise.

Automated: every check must pass. Scanners report each check by its id.

forward

Effective ForwardToSyslog= compared with the presence of rsyslog.

script: |
  v=$(systemd-analyze cat-config systemd/journald.conf 2>/dev/null | sed -n 's/^[[:space:]]*ForwardToSyslog=//p' | tail -n 1)
  case ${v:-no} in yes | true | on | 1) v=yes ;; *) v=no ;; esac
  case $(dpkg-query -W -f='${Status}' rsyslog 2>/dev/null) in
    *' installed') want=yes ;;
    *) want=no ;;
  esac
  echo "ForwardToSyslog=$v, expected $want"
  [ "$v" = "$want" ]

Remediation

Create /etc/systemd/journald.conf.d/syslog.conf with [Journal] and ForwardToSyslog=yes if rsyslog is installed, ForwardToSyslog=no otherwise, then run systemctl restart systemd-journald.

Restartservice: systemd-journald
Disruptionnone

Rollback

Delete /etc/systemd/journald.conf.d/syslog.conf and run systemctl restart systemd-journald.

dropin

case $(dpkg-query -W -f='${Status}' rsyslog 2>/dev/null) in
  *' installed') v=yes ;;
  *) v=no ;;
esac
f=/etc/systemd/journald.conf.d/syslog.conf
mkdir -p /etc/systemd/journald.conf.d
cb_backup "$f"
printf '%s\n' '# Written by CIRSEC Baselines CB-DEB-AUDIT-002' '[Journal]' "ForwardToSyslog=$v" >"$f"
chmod 644 "$f"

Handwritten code reads parameters from CB_<NAME> environment variables. Each release turns these fixes into remediate.sh and an Ansible role per profile: dry run by default, a fix runs only when its check fails.

References

Mappings

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

  • related CB-DEB-AUDIT-001 Keep the systemd journal running, persistent, compressed and bounded in size
  • related CB-DEB-AUDIT-005 Run rsyslog and create its log files with restricted permissions

People and lifecycle

Authors
Verified2026-10-18 by Sn0wAlice on 12, Proxmox VM, Debian 12 genericcloud image, kernel 6.1.0-54-cloud-amd64, BIOS boot. Passes on fresh install (no rsyslog, default no); after installing rsyslog fails, fix writes ForwardToSyslog=yes and passes.
Verified2026-10-18 by Sn0wAlice on 13, Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64, BIOS boot. Fails on fresh install (vendor syslog.conf sets yes without rsyslog); fix masks it with no; with rsyslog installed the fix sets yes.
Introduced inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr