lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.8.5 vs lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.8.6

- old
+ new

@@ -166,10 +166,18 @@ @storage_class = "REDUCED_REDUNDANCY" end @path = process_deprecated_placeholders(@path) @s3_object_key_format = process_deprecated_placeholders(@s3_object_key_format) + if !@check_object + if conf.has_key?('s3_object_key_format') + log.warn "Set 'check_object false' and s3_object_key_format is specified. Check s3_object_key_format is unique in each write. If not, existing file will be overwritten." + else + log.warn "Set 'check_object false' and s3_object_key_format is not specified. Use '%{path}/%{date_slice}_%{hms_slice}.%{file_extension}' for s3_object_key_format" + @s3_object_key_format = "%{path}/%{date_slice}_%{hms_slice}.%{file_extension}" + end + end @values_for_s3_object_chunk = {} end def start options = setup_credentials @@ -190,14 +198,10 @@ @bucket = @s3.bucket(@s3_bucket) check_apikeys if @check_apikey_on_start ensure_bucket if @check_bucket - if !@check_object - @s3_object_key_format = "%{path}/%{date_slice}_%{hms_slice}.%{file_extension}" - end - super end def format(tag, time, record) @formatter.format(tag, time, record) @@ -244,9 +248,10 @@ hms_slicer = Time.now.utc.strftime("%H%M%S") end values_for_s3_object_key = { "path" => @path_slicer.call(@path), + "time_slice" => chunk.key, "date_slice" => chunk.key, "file_extension" => @compressor.ext, "hms_slice" => hms_slicer, } s3path = @s3_object_key_format.gsub(%r(%{[^}]+})) { |expr|