diff --git a/k8s/loki/templates/podlogs.yaml b/k8s/loki/templates/podlogs.yaml index d1d2692..35c8962 100644 --- a/k8s/loki/templates/podlogs.yaml +++ b/k8s/loki/templates/podlogs.yaml @@ -46,10 +46,10 @@ spec: - cri: {} - regex: # Capture into a temporary variable 'raw_level' to avoid overwriting existing logic - expression: '^\[.*\] \[(?P\w+)\]\s+(?P.*)$' + expression: '\[(?PDEBUG|INFO|WARN|ERROR|LOG|TRACE)\]\s+(?P.*)$' - template: source: level # If raw_level exists (regex matched), map it. Otherwise, default to 'info'. - template: '{{ "{{" }} if eq .Extraction.raw_level "LOG" {{ "}}" }}info{{ "{{" }} else if eq .Extraction.raw_level "WARN" {{ "}}" }}warn{{ "{{" }} else if eq .Extraction.raw_level "ERROR" {{ "}}" }}error{{ "{{" }} else if .Extraction.raw_level {{ "}}" }}{{ "{{" }} .Extraction.raw_level | lower {{ "}}" }}{{ "{{" }} else {{ "}}" }}info{{ "{{" }} end {{ "}}" }}' + template: '{{ "{{" }} if eq .Extraction.raw_level "LOG" {{ "}}" }}info{{ "{{" }} else if eq .Extraction.raw_level "WARN" {{ "}}" }}warn{{ "{{" }} else if eq .Extraction.raw_level "ERROR" {{ "}}" }}error{{ "{{" }} else if eq .Extraction.raw_level "DEBUG" {{ "}}" }}debug{{ "{{" }} else if .Extraction.raw_level {{ "}}" }}{{ "{{" }} .Extraction.raw_level | lower {{ "}}" }}{{ "{{" }} else {{ "}}" }}info{{ "{{" }} end {{ "}}" }}' - labels: level: level