From 46b72a7efc99abba0a4aa53e36729a82a6727f4a Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Wed, 9 Jul 2025 09:13:45 -0700 Subject: [PATCH] set a maximum systemd journal size We've noticed a trend with deploys where we seem to use up all of the free space in the ramdisk, and this could distinctly be systemd. While we're not logging it, we odn't need infinite logs either because the default pattern is likely to consume quite a bit more space than we would like to use. As such, set a max size. Related-Bug: 2116135 Change-Id: Iae94278640d79232ec66402c799e4bd6e42336df Signed-off-by: Julia Kreger --- dib/ironic-python-agent-ramdisk/README.rst | 3 +++ .../post-install.d/98-set-journal-config | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100755 dib/ironic-python-agent-ramdisk/post-install.d/98-set-journal-config diff --git a/dib/ironic-python-agent-ramdisk/README.rst b/dib/ironic-python-agent-ramdisk/README.rst index d348823..6137abe 100644 --- a/dib/ironic-python-agent-ramdisk/README.rst +++ b/dib/ironic-python-agent-ramdisk/README.rst @@ -25,6 +25,9 @@ Beyond installing the ironic-python-agent, this element does the following: listen for raw data from stdin and write compressed data to stdout. Command can be with arguments. * Configures rescue mode if ``DIB_IPA_ENABLE_RESCUE`` is not set to ``false``. +* By default, sets a maximum size for the ramdisk systemd journal to 15M. This + can be disabled by setting ``DIB_IPA_DISABLE_JOURNAL_MAX_LOG_SIZE`` to any + value which is not ``False``. This element outputs three files: diff --git a/dib/ironic-python-agent-ramdisk/post-install.d/98-set-journal-config b/dib/ironic-python-agent-ramdisk/post-install.d/98-set-journal-config new file mode 100755 index 0000000..727953c --- /dev/null +++ b/dib/ironic-python-agent-ramdisk/post-install.d/98-set-journal-config @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +DIB_IPA_DISABLE_JOURNAL_MAX_LOG_SIZE=${DIB_IPA_DISABLE_JOURNAL_MAX_LOG_SIZE:-False} + +if [[ "$DIB_IPA_DISABLE_JOURNAL_MAX_LOG_SIZE" == "False" ]]; then + # Default templates have a journal section already defined, and we don't use + # iniset by convention, so unless we really need to, we'll just append here. + echo "SystemMaxUse=15M" >> /etc/systemd/journald.conf +fi