From eb3bd485c40c9ea69f5c87a7b86c60dd934a0698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 13 Oct 2023 03:43:03 +0200 Subject: [PATCH 1/2] metrics: Add size limit to victoriametrics --- configuration/services/metrics/victoriametrics.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration/services/metrics/victoriametrics.nix b/configuration/services/metrics/victoriametrics.nix index a5149f7..4cdc770 100644 --- a/configuration/services/metrics/victoriametrics.nix +++ b/configuration/services/metrics/victoriametrics.nix @@ -1,6 +1,9 @@ {config, ...}: { config.services.victoriametrics = { enable = true; + extraOptions = [ + "-storage.minFreeDiskSpaceBytes=5GB" + ]; scrapeConfigs = { gitea = { -- 2.44.1 From 95b5d4b3bd879783cef39f4d50f902e55548313f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 13 Oct 2023 10:16:10 +0200 Subject: [PATCH 2/2] nginx: Reduce number of rotated logs kept around --- configuration/default.nix | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/configuration/default.nix b/configuration/default.nix index 81e7241..6f7cf41 100644 --- a/configuration/default.nix +++ b/configuration/default.nix @@ -153,16 +153,21 @@ services.logrotate = { enable = true; - settings = lib.mapAttrs' (virtualHost: _: - lib.nameValuePair "/var/log/nginx/${virtualHost}/access.log" { - frequency = "daily"; - rotate = 2; - compress = true; - delaycompress = true; - su = "${config.services.nginx.user} ${config.services.nginx.group}"; - postrotate = "[ ! -f /var/run/nginx/nginx.pid ] || kill -USR1 `cat /var/run/nginx/nginx.pid`"; - }) - config.services.nginx.virtualHosts; + settings = + { + # Override the default, just keep fewer logs + nginx.rotate = 6; + } + // lib.mapAttrs' (virtualHost: _: + lib.nameValuePair "/var/log/nginx/${virtualHost}/access.log" { + frequency = "daily"; + rotate = 2; + compress = true; + delaycompress = true; + su = "${config.services.nginx.user} ${config.services.nginx.group}"; + postrotate = "[ ! -f /var/run/nginx/nginx.pid ] || kill -USR1 `cat /var/run/nginx/nginx.pid`"; + }) + config.services.nginx.virtualHosts; }; systemd.tmpfiles.rules = lib.mapAttrsToList ( -- 2.44.1