From ef29560c7c5828d94bbe34eab7491a2c7e03a661 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Mon, 19 Jun 2023 02:43:14 -0400 Subject: [PATCH] Only keep 7 days of logs --- modules/linux/base.nix | 6 ++++++ modules/linux/services/nginx.nix | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/modules/linux/base.nix b/modules/linux/base.nix index 18c0230..7fb0bd1 100644 --- a/modules/linux/base.nix +++ b/modules/linux/base.nix @@ -72,5 +72,11 @@ with lib; { services.iperf3.enable = true; environment.systemPackages = with pkgs; [ iperf ]; } + # Don't store logs longer than 7 days + { + services.journald.extraConfig = '' + MaxRetentionSec=7day + ''; + } ]; } diff --git a/modules/linux/services/nginx.nix b/modules/linux/services/nginx.nix index 8529452..d1dabab 100644 --- a/modules/linux/services/nginx.nix +++ b/modules/linux/services/nginx.nix @@ -14,6 +14,11 @@ in with lib; { recommendedGzipSettings = true; recommendedProxySettings = true; }; + # Only keep 7 days of logs + services.logrotate.settings.nginx = { + rotate = 7; + frequency = "daily"; + }; }) (mkIf nathan.services.nginx.acme { security.acme = {