diff options
author | Martin Fischer <martin@push-f.com> | 2025-03-11 08:12:21 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-03-12 08:10:54 +0100 |
commit | 0d5bc2d4c110c88777bb5320f9200b80286ba836 (patch) | |
tree | 369ef1c431bd59cd9a710ab6a15b8d9c308869ce | |
parent | 326b5f556ccbf3ab2e17cdc9415833267466f0e1 (diff) |
feat(tente): derive filetype metadata for HTTP requests
-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" { |