log level

This commit is contained in:
Seth Call 2026-01-16 16:15:03 -06:00
parent 24da9f4514
commit b1eec13907
1 changed files with 3 additions and 3 deletions

View File

@ -46,11 +46,11 @@ spec:
- cri: {} - cri: {}
- regex: - regex:
# Capture into a temporary variable 'raw_level' to avoid overwriting existing logic # Capture into a temporary variable 'raw_level' to avoid overwriting existing logic
# Matches any of the keywords anywhere in the line, potentially surrounded by ANSI codes/junk # Matches any of the keywords anywhere in the line
expression: '(?P<raw_level>DEBUG|INFO|WARN|ERROR|LOG|TRACE)' expression: '(?P<raw_level>DEBUG|INFO|WARN|ERROR|LOG|TRACE)'
- template: - template:
source: level source: level
# Use contains logic to match the extracted level keyword # Use simple equality check on the extracted keyword
template: '{{ "{{" }} if contains .Extraction.raw_level "ERROR" {{ "}}" }}error{{ "{{" }} else if contains .Extraction.raw_level "WARN" {{ "}}" }}warn{{ "{{" }} else if contains .Extraction.raw_level "DEBUG" {{ "}}" }}debug{{ "{{" }} else if contains .Extraction.raw_level "TRACE" {{ "}}" }}trace{{ "{{" }} else if .Extraction.raw_level {{ "}}" }}info{{ "{{" }} else {{ "}}" }}unknown{{ "{{" }} 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 eq .Extraction.raw_level "TRACE" {{ "}}" }}trace{{ "{{" }} else if .Extraction.raw_level {{ "}}" }}{{ "{{" }} .Extraction.raw_level | lower {{ "}}" }}{{ "{{" }} else {{ "}}" }}info{{ "{{" }} end {{ "}}" }}'
- labels: - labels:
level: level level: level