log level
This commit is contained in:
parent
24da9f4514
commit
b1eec13907
|
|
@ -46,11 +46,11 @@ spec:
|
|||
- cri: {}
|
||||
- regex:
|
||||
# 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)'
|
||||
- template:
|
||||
source: level
|
||||
# Use contains logic to match the extracted level 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 {{ "}}" }}'
|
||||
# Use simple equality check on the extracted keyword
|
||||
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:
|
||||
level: level
|
||||
|
|
|
|||
Loading…
Reference in New Issue