log level
This commit is contained in:
parent
24da9f4514
commit
b1eec13907
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue