6.1.1.4 Ensure journald Storage is configured

Information

Data from journald may be stored in volatile memory or persisted locally on the server. Logs in memory will be lost upon a system reboot. By persisting logs to local disk on the server they are protected from loss due to a reboot.

Writing log data to disk will provide the ability to forensically reconstruct events which may have impacted the operations or security of a system even after a system crash or reboot.

Solution

Note: Drop-in configuration files have higher precedence and override the main configuration file. Files in the *.conf.d/ configuration subdirectories are sorted by their filename in lexicographic order, regardless of in which of the subdirectories they reside. When multiple files specify the same option, for options which accept just a single value, the entry in the file sorted last takes precedence, and for options which accept a list of values, entries are collected as they occur in the sorted files.

- Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending in .conf :

Storage=persistent

Example:

#!/usr/bin/env bash

{
[ ! -d /etc/systemd/journald.conf.d/ ] && mkdir -p /etc/systemd/journald.conf.d/
if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then
printf '%s\n' "Storage=persistent" >> /etc/systemd/journald.conf.d/60-journald.conf
else
printf '%s\n' "" "[Journal]" "Storage=persistent" >> /etc/systemd/journald.conf.d/60-journald.conf
fi
}
-

- IF - The Storage option was returned by the audit procedure in more than one file, edit the file or files returned by the audit script as needed to ensure only one file contains the option in the [Journal] block.

-

Run to following command to update the parameters in the service:

# systemctl reload-or-restart systemd-journald

See Also

https://workbench.cisecurity.org/benchmarks/25279

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-6b., CSCv7|6.2, CSCv7|6.3

Plugin: Unix

Control ID: 51185c859ae79512f4ec7107a440726ec1c89986b5559bc68547cd7494f9b18c