"…" not found in state data
You referenced a field that does not exist for this log line. Initialise every temp field at the top, and guard JSON keys that are not always present.
The error
pipeline failed: filter conditional (4) failed: failed to evaluate expression: generic::invalid_argument: "product" not found in state dataWhy it happens
A condition or a %{field} reference points at a field that was never created for this line: the JSON key is missing in this event, or the grok that should have extracted it did not match.
Works on one sample and fails on another, which is why it often shows up only in validation.
How to fix it
- Declare every temp field you later test, with an empty value, in one replace block at the top of the parser.
- For JSON keys that are not always present, copy them into a temp field with on_error, then test the temp field.
Works:
mutate {
replace => { "product" => "" "user" => "" "src_ip" => "" }
}
mutate {
replace => { "product" => "%{event.product}" }
on_error => "no_product"
}
if [product] != "" {
mutate { replace => { "event.idm.read_only_udm.metadata.product_name" => "%{product}" } }
}Still failing?
One error usually hides the next. Parsleaf writes the full parser from your sample logs and keeps fixing it from the errors your SecOps tenant returns, until it passes. Generate your parser: the first one is free.