Remove logfmt parsing stage from Alloy k8s config

The stage.match selector wasn't preventing Alloy from logging decode
errors internally. Removing logfmt parsing entirely - JSON parsing
handles most structured logs, and plain text logs still get collected.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-01-22 18:06:34 -08:00
commit 11075d4517

View file

@ -102,32 +102,16 @@ data:
}
}
// Try to parse logfmt logs, but only for non-JSON lines
// This prevents noisy decode errors when JSON logs hit the logfmt parser
stage.match {
selector = "{namespace=~\".+\"} |~ \"^[^{]\"" // Lines not starting with '{'
stage.logfmt {
mapping = {
level = "level",
ts = "ts",
caller = "caller",
component = "component",
}
}
}
// Drop any error labels from parsing attempts (both JSON and logfmt)
// Drop JSON parsing error labels (non-JSON logs are fine, just won't have extracted fields)
stage.label_drop {
values = ["__error__", "__error_details__"]
}
// Extract labels from parsed data (works for both JSON and logfmt)
// Extract labels from parsed JSON data
stage.labels {
values = {
level = "",
caller = "",
component = "",
repository = "",
}
}