diff options
-rw-r--r-- | nixos/hosts/tente/monitoring.nix | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/nixos/hosts/tente/monitoring.nix b/nixos/hosts/tente/monitoring.nix index c761018..ce0d302 100644 --- a/nixos/hosts/tente/monitoring.nix +++ b/nixos/hosts/tente/monitoring.nix @@ -180,7 +180,7 @@ in } stage.json { - expressions = { "msec" = "" } + expressions = { "msec" = "", path = "" } } stage.timestamp { @@ -199,6 +199,50 @@ in stage.structured_metadata { values = { level = "" } } + + stage.labels { + values = { + // Temporarily adding path as a label so that we can use it in the match selectors. + path = "", + } + } + + stage.match { + selector = "{path=~\"/\\\\.well-known/.*\"}" + // Creating the filetype entry via stage.template because there's no + // static_structured_metadata stage yet. (https://github.com/grafana/loki/issues/16703) + stage.template { + source = "filetype" + template = "well-known" + } + } + + stage.match { + selector = "{path=\"/robots.txt\"}" + stage.template { + source = "filetype" + template = "robots.txt" + } + } + + stage.match { + selector = "{path=~\".*\\\\.atom$\"}" + stage.template { + source = "filetype" + template = "feed" + } + } + + stage.structured_metadata { + values = { + filetype = "", + } + } + + // Dropping path again because it has a too high cardinality for a label. + stage.label_drop { + values = [ "path" ] + } } loki.write "default" { |