Skip to content

Commit

Permalink
Merge pull request #210 from tpetr/more-fixes
Browse files Browse the repository at this point in the history
log chunk ID and support %{index} placeholder in S3 metadata
  • Loading branch information
repeatedly authored Oct 17, 2017
2 parents 868d1f8 + 394aba8 commit 22217d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/plugin/out_s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def write(chunk)
begin
@compressor.compress(chunk, tmp)
tmp.rewind
log.debug "out_s3: write chunk with metadata #{chunk.metadata} to s3://#{@s3_bucket}/#{s3path}"
log.debug "out_s3: write chunk #{dump_unique_id_hex(chunk.unique_id)} with metadata #{chunk.metadata} to s3://#{@s3_bucket}/#{s3path}"

put_options = {
body: tmp,
Expand All @@ -290,7 +290,7 @@ def write(chunk)
if @s3_metadata
put_options[:metadata] = {}
@s3_metadata.each do |k, v|
put_options[:metadata][k] = extract_placeholders(v, metadata)
put_options[:metadata][k] = extract_placeholders(v, metadata).gsub(%r(%{[^}]+}), {"%{index}" => i - 1})
end
end
@bucket.object(s3path).put(put_options)
Expand Down

0 comments on commit 22217d5

Please sign in to comment.