Skip to content
Merged
19 changes: 14 additions & 5 deletions src/sinks/s3_common/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ impl Service<S3Request> for S3Service {
let client = self.client.clone();

Box::pin(async move {
let request = client
let put_request = client
.put_object()
.body(bytes_to_bytestream(request.body))
.bucket(request.bucket)
.key(request.metadata.s3_key)
.bucket(request.bucket.clone())
.key(request.metadata.s3_key.clone())
.set_content_encoding(content_encoding)
.set_content_type(content_type)
.set_acl(options.acl.map(Into::into))
Expand All @@ -144,9 +144,18 @@ impl Service<S3Request> for S3Service {
.set_tagging(tagging)
.content_md5(content_md5);

let result = request.send().in_current_span().await;
let result = put_request.send().in_current_span().await;

result.map(|_| S3Response { events_byte_size })
result.map(|_| {
trace!(
target: "vector::sinks::s3_common::service::put_object",
message = "Put object to s3-compatible storage.",
bucket = request.bucket,
key = request.metadata.s3_key
);

S3Response { events_byte_size }
})
})
}
}
Expand Down
11 changes: 11 additions & 0 deletions website/cue/reference/components/sinks/aws_s3.cue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ components: sinks: aws_s3: components._aws & {
"""
}

log_on_put: {
title: "Emit a log when putting an object"
body: """
If you're using Vector to write objects to an s3-compatible storage, you can
set `VECTOR_LOG` to `vector::sinks::s3_common::service::put_object=trace` to
enable a trace log containing the bucket and key the object was put to. This
is best used when writing an object to an s3-compatible storage to kick off
post-put operations through another sink.
"""
}

object_acl: {
title: "Object Access Control List (ACL)"
body: """
Expand Down
Loading