out_s3: fix prefix match in log_key extraction#12008
Conversation
Signed-off-by: Vaibhav-C-S <vaibhavsharma.c@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesS3 log-key matching
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
cc: @ShelbyZ |
This fixes
log_keyextraction in the S3 output to require an exact key match.Previously,
flb_pack_msgpack_extract_log_key()compared the configuredlog_keyagainst each record key using the record key length, but did not verify that both keys had the same length. This allowed shorter prefix keys to match longer configured keys.For example, with
log_key log_processed, a record containing bothlogandlog_processedcould upload the value oflogif it appeared first in the record.This change checks that the configured
log_keylength matches the record key length before comparing the key bytes.For example, with this config:
and this record:
the record key
logcould match the configured keylog_processedif log appeared first in the record, because only the first 3 characters are compared:resulting output:
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Verified uploaded object content locally with MinIO.
Before this change, the output uploadis:
wrongAfter this change, with the same config, the uploaded object content is:
correctThis change only tightens the existing
log_keycomparison logic and does not add new allocations or frees.If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit