From a2e115f091fe70517eb3e461d2d38dc86c64577f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1r=C3=A1ndi=20Tam=C3=A1s?= Date: Thu, 3 Aug 2023 15:17:28 +0200 Subject: [PATCH] Support nginx error logs in promtail scrape configs --- modules/wireguard-monitoring/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/wireguard-monitoring/default.nix b/modules/wireguard-monitoring/default.nix index 7290394..8f48559 100644 --- a/modules/wireguard-monitoring/default.nix +++ b/modules/wireguard-monitoring/default.nix @@ -80,10 +80,23 @@ in { replacement = "$2"; } ]; - }]; + }] ++ (if config.services.nginx.enable + then [{ + job_name = "nginx-error-logs"; + static_configs = [{ + targets = [ "localhost" ]; + labels = { + job = "nginx-error-logs"; + host = config.networking.hostName; + __path__ = "/var/log/nginx/*error.log"; + }; + }]; + }] else []); }; }; + users.users.promtail.extraGroups = lib.mkIf config.services.nginx.enable [ "nginx" ]; + # wait for wireguard before starting node-exporter systemd.services.prometheus-node-exporter.after = [ "wireguard-wg0.service" ]; };