From 5591f2f4bd658216d3fe8f399e48be596f375e98 Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@leastauthority.com>
Date: Tue, 24 Sep 2024 15:14:48 +0000
Subject: [PATCH] Limit journald disk usage on machines that ship logs away

---
 nixos/modules/monitoring/exporters/promtail.nix | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nixos/modules/monitoring/exporters/promtail.nix b/nixos/modules/monitoring/exporters/promtail.nix
index 8c408034..75994b68 100644
--- a/nixos/modules/monitoring/exporters/promtail.nix
+++ b/nixos/modules/monitoring/exporters/promtail.nix
@@ -47,6 +47,12 @@ in {
       # for further details about these options.
       #
       MaxFileSec=1day
+
+      # This asks journald to not use more than 500M of disk space.  Due to
+      # journald's characteristics this might only be a week of logs, but that
+      # should be okay since we ship all logs to a central server that keeps
+      # them for a while longer.
+      SystemMaxUse=500M
     '';
 
     services.promtail.configuration = {
-- 
GitLab