Fix numeric log levels showing as errors in Grafana
1Password Connect uses numeric log levels (1=error, 2=warn, 3=info, 4=debug) which Grafana's logs panel doesn't recognize, rendering all lines with error styling. Add stage.replace rules in both Alloy configs (indri + ringtail) to map numeric levels to standard strings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0e2ad47433
commit
7a4719ed0c
2 changed files with 46 additions and 0 deletions
|
|
@ -109,6 +109,29 @@ loki.process "pods" {
|
|||
}
|
||||
}
|
||||
|
||||
// Map numeric log levels (e.g. 1Password Connect: 1=error,2=warn,3=info,4=debug)
|
||||
// to standard strings so Grafana logs panel colors them correctly
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^1$"
|
||||
replace = "error"
|
||||
}
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^2$"
|
||||
replace = "warn"
|
||||
}
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^3$"
|
||||
replace = "info"
|
||||
}
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^4$"
|
||||
replace = "debug"
|
||||
}
|
||||
|
||||
// Add cluster label for multi-cluster identification
|
||||
stage.static_labels {
|
||||
values = { cluster = "indri" }
|
||||
|
|
|
|||
|
|
@ -147,6 +147,29 @@ loki.process "pods" {
|
|||
}
|
||||
}
|
||||
|
||||
// Map numeric log levels (1Password Connect uses 1=error,2=warn,3=info,4=debug)
|
||||
// to standard strings so Grafana logs panel colors them correctly
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^1$"
|
||||
replace = "error"
|
||||
}
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^2$"
|
||||
replace = "warn"
|
||||
}
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^3$"
|
||||
replace = "info"
|
||||
}
|
||||
stage.replace {
|
||||
source = "level"
|
||||
expression = "^4$"
|
||||
replace = "debug"
|
||||
}
|
||||
|
||||
// Add cluster label for multi-cluster identification
|
||||
stage.static_labels {
|
||||
values = { cluster = "ringtail" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue