Skip to content

Commit

Permalink
DLPX-86528 CIS: journald configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
dbshah12 committed Sep 23, 2024
1 parent b3bb7d8 commit f2f7762
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
6 changes: 0 additions & 6 deletions files/common/lib/systemd/journald.conf.d/override.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
[Journal]
#
# Configure journald to persistently keep logs, so that we can inspect
# them after a reboot has already occurred. This helps debugging, and
# also can make the collection of support bundles more useful.
#
Storage=persistent
SystemMaxUse=2.5G
#
# The platform service will burst a few thousand lines into the logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,3 +738,34 @@
path: /etc/environment
state: absent
regexp: '^\s*PATH\s*='

- lineinfile:
path: /etc/systemd/journald.conf
regexp: "{{ item.regex }}"
line: "{{ item.line }}"
state: present
with_items:
#
# Enable forwarding of journald logs to the syslog service
# This helps to ensure compatibility with legacy log systems
# that rely on syslog for centralized log collection.
#
- { regex: '^#?ForwardToSyslog=', line: 'ForwardToSyslog=yes' }
#
# Enable compression for journald logs to save disk space.
# Older log files will be compressed automatically, helping to
# retain logs longer without using excessive storage.
#
- { regex: '^#?Compress=', line: 'Compress=yes' }
#
# Configure journald to persistently keep logs on disk, ensuring
# logs are available after reboots. This is useful for post-reboot
# debugging and for collecting support bundles with log history.
#
- { regex: '^#?Storage=', line: 'Storage=persistent' }

- name: Reload and restart systemd-journald to apply changes
ansible.builtin.systemd:
name: systemd-journald
state: restarted
daemon_reload: yes

0 comments on commit f2f7762

Please sign in to comment.