From 97238d5004b56d2ddcd09c7a9088b602a7d8084d Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Wed, 13 Apr 2022 13:36:13 +0000
Subject: [PATCH] Add monitoring retention policy module

---
 nixos/modules/default.nix           |  1 +
 nixos/modules/monitoring/policy.nix | 11 +++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 nixos/modules/monitoring/policy.nix

diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix
index 09796ef5..86ce85c1 100644
--- a/nixos/modules/default.nix
+++ b/nixos/modules/default.nix
@@ -13,6 +13,7 @@
     ./packages.nix
     ./issuer.nix
     ./private-storage.nix
+    ./monitoring/policy.nix
     ./monitoring/vpn/client.nix
     ./monitoring/exporters/node.nix
     ./monitoring/exporters/tahoe.nix
diff --git a/nixos/modules/monitoring/policy.nix b/nixos/modules/monitoring/policy.nix
new file mode 100644
index 00000000..599d0bb4
--- /dev/null
+++ b/nixos/modules/monitoring/policy.nix
@@ -0,0 +1,11 @@
+# Codify our log data retention policy
+
+{ options, lib, ... }: {
+  options.services.private-storage.monitoring.policy = {
+    logRetentionSeconds = lib.mkOption {
+      type = lib.types.int;
+      description = "How long do we retain logs (seconds)";
+      default = 29 * (24 * 60 * 60);  # 29 days.
+    };
+  };
+}
-- 
GitLab