Fix 1Password Connect numeric log levels misclassified in Grafana #287

Merged
eblume merged 2 commits from fix/onepassword-numeric-log-levels into main 2026-03-07 13:57:05 -08:00
Showing only changes of commit 744255056b - Show all commits

Apply same numeric log level fix to alloy-ringtail

1password-connect also runs on ringtail's k3s cluster, so the same
stage.match + stage.template normalization is needed there too.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Erich Blume 2026-03-07 13:54:18 -08:00

View file

@ -139,6 +139,18 @@ loki.process "pods" {
values = ["__error__", "__error_details__"]
}
// Normalize 1password-connect numeric log levels to strings (1=error..5=trace)
// Scoped to the 1password namespace so other services are unaffected.
// See: https://github.com/1Password/connect/issues/44
stage.match {
selector = "{namespace=\"1password\"}"
stage.template {
source = "level"
template = "{{ if eq .Value \"1\" }}error{{ else if eq .Value \"2\" }}warn{{ else if eq .Value \"3\" }}info{{ else if eq .Value \"4\" }}debug{{ else if eq .Value \"5\" }}trace{{ else }}{{ .Value }}{{ end }}"
}
}
// Extract labels from parsed JSON data
stage.labels {
values = {