Skip to content

S3 sink without path_prefix provided should write to bucket root#6101

Merged
san81 merged 1 commit into
opensearch-project:mainfrom
san81:s3-path-prefix-default
Sep 24, 2025
Merged

S3 sink without path_prefix provided should write to bucket root#6101
san81 merged 1 commit into
opensearch-project:mainfrom
san81:s3-path-prefix-default

Conversation

@san81

@san81 san81 commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

Description

object_key and path_prefix configuration options under S3 sink are optional. If not provided, S3 sink should write to the root of the bucket, but in the current state, it is failing. This code change fixes it.

Issues Resolved

Resolves #6090

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
@@ -35,7 +35,8 @@ public KeyGenerator(final S3SinkConfig s3SinkConfig,
*/
public String generateKeyForEvent(final Event event) {
final String pathPrefix = s3BucketSelector != null ? s3BucketSelector.getPathPrefix() : ObjectKey.buildingPathPrefix(s3SinkConfig, event, expressionEvaluator);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the NPE comes from the call to buildingPathPrefix here, so this change doesn't prevent it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ObjectKey.buildingPathPrefix method fix is also included in this PR.

@san81 san81 merged commit 74824b3 into opensearch-project:main Sep 24, 2025
45 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S3 sink without path_prefix provided is failing to write

3 participants