Skip to content

out_opensearch: strip spaces around commas in remove_keys_on_update - #206

Merged
Watson1978 merged 1 commit into
fluent:mainfrom
lbarrosby:fix-remove-keys-on-update-spaces
Nov 17, 2026
Merged

Watson1978 merged 1 commit into
fluent:mainfrom
lbarrosby:fix-remove-keys-on-update-spaces

Conversation

@lbarrosby

@lbarrosby lbarrosby commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

remove_keys is split with /\s*,\s*/, and the README example for it has a space after the comma (remove_keys a_parent, a_routing). remove_keys_on_update is split with ',' only. So the same style there:

write_operation upsert
remove_keys_on_update foo, baz

removes foo from the update document but looks for a key literally named " baz", and baz is still sent in doc and overwritten on every update.

remove_keys_on_update now uses the same /\s*,\s*/ separator as remove_keys. Values without spaces (foo,bar, as in the README) split the same as before. remove_keys_on_update_key reads the list from the record and is not affected.

Test: test_upsert_should_remove_keys_listed_with_spaces_after_commas in test/plugin/test_out_opensearch.rb checks that foo, baz leaves {"id" => 1, "zip" => "zam"} in doc. It fails on main, where baz is still in the document, and passes with this change. test/plugin/test_out_opensearch.rb: 315 tests, 0 failures, 0 errors (TZ=UTC).

(check all that apply)

  • tests added
  • tests passing
  • README updated (if needed)
  • README Table of Contents updated (if needed)
  • History.md and version in gemspec are untouched
  • backward compatible

remove_keys_on_update was split on ',' alone, so "foo, bar" removed foo
and looked for a key named " bar", and bar was still updated.
remove_keys already splits on /\s*,\s*/; use the same separator.

Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. The new test fails on main, where baz stays in doc, and passes with this change. Values without spaces around commas split the same as before. Lists read from the record with remove_keys_on_update_key are not affected.

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants