From 58d99eb4023d628d014fe7241d0e47c99fbecb60 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 12 Dec 2020 10:39:57 +0100 Subject: [PATCH] bundles/systemd: configure journald --- bundles/raspberrypi/metadata.py | 7 +++++++ bundles/systemd/files/journald.conf | 16 ++++++++++++++++ bundles/systemd/items.py | 20 ++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 bundles/systemd/files/journald.conf diff --git a/bundles/raspberrypi/metadata.py b/bundles/raspberrypi/metadata.py index b03c085..169836c 100644 --- a/bundles/raspberrypi/metadata.py +++ b/bundles/raspberrypi/metadata.py @@ -20,4 +20,11 @@ defaults = { 'net.ifnames=0', }, }, + 'systemd': { + 'journal': { + 'storage': 'volatile', + 'maxuse': '100M', + 'keepfree': '100M', + }, + }, } diff --git a/bundles/systemd/files/journald.conf b/bundles/systemd/files/journald.conf new file mode 100644 index 0000000..4d91060 --- /dev/null +++ b/bundles/systemd/files/journald.conf @@ -0,0 +1,16 @@ +[Journal] +Storage=${journal.get('storage', 'persistent')} +Compress=yes +SplitMode=uid + +# Disable rate limiting. +RateLimitIntervalSec=0 +RateLimitBurst=0 + +SystemMaxUse=${journal.get('maxuse', '500M')} +SystemKeepFree=${journal.get('keepfree', '2G')} +SystemMaxFileSize=100M +MaxFileSec=0 + +# Disable auditing +Audit=no diff --git a/bundles/systemd/items.py b/bundles/systemd/items.py index ac4493e..b8f6436 100644 --- a/bundles/systemd/items.py +++ b/bundles/systemd/items.py @@ -24,3 +24,23 @@ actions = { 'unless': 'timedatectl status | grep -Fi \'ntp service\' | grep -i \'active\'', }, } + +files = { + '/etc/systemd/journald.conf': { + 'content_type': 'mako', + 'context': { + 'journal': node.metadata.get('systemd', {}).get('journal', {}), + }, + 'triggers': { + 'svc_systemd:systemd-journald:restart', + }, + }, +} + +svc_systemd = { + 'systemd-journald': { + 'needs': { + 'file:/etc/systemd/journald.conf', + }, + }, +}