From e81e9feef3efb943edb3d82d223d45eb17b346c9 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 13 Feb 2024 11:16:17 -0500 Subject: [PATCH] replace MaxRetentionSec to stop excessive rotation --- systemd/journald.conf | 2 +- systemd/system/systemd-journald-vacuum.service | 9 +++++++++ systemd/system/systemd-journald-vacuum.timer | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 systemd/system/systemd-journald-vacuum.service create mode 100644 systemd/system/systemd-journald-vacuum.timer diff --git a/systemd/journald.conf b/systemd/journald.conf index ae0811f..ca4c1e0 100644 --- a/systemd/journald.conf +++ b/systemd/journald.conf @@ -32,7 +32,7 @@ SystemMaxFiles=10000 #RuntimeKeepFree= #RuntimeMaxFileSize= #RuntimeMaxFiles=100 -MaxRetentionSec={{journald_max_retention_sec}} +#MaxRetentionSec= MaxFileSec=1day #ForwardToSyslog=no #ForwardToKMsg=no diff --git a/systemd/system/systemd-journald-vacuum.service b/systemd/system/systemd-journald-vacuum.service new file mode 100644 index 0000000..ce32e38 --- /dev/null +++ b/systemd/system/systemd-journald-vacuum.service @@ -0,0 +1,9 @@ +[Unit] +Description=Vacuum journald logs +After=systemd-journald.service + +[Service] +Type=oneshot +User=root +Group=root +ExecStart=/usr/bin/journalctl --vacuum-time={{journald_max_retention_sec}} diff --git a/systemd/system/systemd-journald-vacuum.timer b/systemd/system/systemd-journald-vacuum.timer new file mode 100644 index 0000000..0190bdf --- /dev/null +++ b/systemd/system/systemd-journald-vacuum.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run systemd-journald-vacuum hourly + +[Timer] +OnCalendar=hourly + +[Install] +WantedBy=timers.target