From d15dc0153fcdd256fa6b1231aaa0b2f10ff6b171 Mon Sep 17 00:00:00 2001 From: Adam <61272766+abcdam@users.noreply.github.com> Date: Thu, 2 Jan 2025 21:01:08 +0000 Subject: [PATCH] fix(config): Correct `filter` transform generation via `vector generate` to use a comparison (#22079) * fix(config): Correct filter transform generation via vector generate to use a comparison * Update changelog.d/22079_correct_filter_condition_via_vector_generate.fix.md --------- Co-authored-by: Jesse Szwedko --- .../22079_correct_filter_condition_via_vector_generate.fix.md | 3 +++ src/transforms/filter.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/22079_correct_filter_condition_via_vector_generate.fix.md diff --git a/changelog.d/22079_correct_filter_condition_via_vector_generate.fix.md b/changelog.d/22079_correct_filter_condition_via_vector_generate.fix.md new file mode 100644 index 0000000000000..927231999fe0b --- /dev/null +++ b/changelog.d/22079_correct_filter_condition_via_vector_generate.fix.md @@ -0,0 +1,3 @@ +The `filter` transform now generates a more accurate config when generated via `vector generate` by using a comparison rather than an assignment. + +authors: abcdam diff --git a/src/transforms/filter.rs b/src/transforms/filter.rs index 3371977cf3b25..cf98c5a45ffec 100644 --- a/src/transforms/filter.rs +++ b/src/transforms/filter.rs @@ -34,7 +34,7 @@ impl From for FilterConfig { impl GenerateConfig for FilterConfig { fn generate_config() -> toml::Value { - toml::from_str(r#"condition = ".message = \"value\"""#).unwrap() + toml::from_str(r#"condition = ".message == \"value\"""#).unwrap() } }