From c656c535f2e42e39b4a3b161815c02254e81f648 Mon Sep 17 00:00:00 2001 From: Alexander Rogov Date: Fri, 26 Jun 2026 20:30:03 +0300 Subject: [PATCH] fix traefik level template: capture first digit, avoid printf --- argocd/apps/alloy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/argocd/apps/alloy.yaml b/argocd/apps/alloy.yaml index c13ae7b..f18aea6 100644 --- a/argocd/apps/alloy.yaml +++ b/argocd/apps/alloy.yaml @@ -91,12 +91,12 @@ spec: selector = "{service=\"traefik\"}" stage.regex { - expression = `\"\w+ .+ HTTP/[\d.]+\" (?P[0-9]{3}) ` + expression = `\"\w+ .+ HTTP/[\d.]+\" (?P[0-9])[0-9]{2} ` } stage.template { source = "level" - template = `{{ if eq (printf "%.1s" .status_code) "5" }}error{{ else if eq (printf "%.1s" .status_code) "4" }}warn{{ else }}info{{ end }}` + template = `{{ if eq .status_class "5" }}error{{ else if eq .status_class "4" }}warn{{ else }}info{{ end }}` } stage.labels {