diff --git a/lib/fluent/plugin/buf_file.rb b/lib/fluent/plugin/buf_file.rb index 4725f5c9fe..70e086d40d 100644 --- a/lib/fluent/plugin/buf_file.rb +++ b/lib/fluent/plugin/buf_file.rb @@ -145,7 +145,13 @@ def resume Dir.glob(escaped_patterns(patterns)) do |path| next unless File.file?(path) - log.debug { "restoring buffer file: path = #{path}" } + if owner.respond_to?(:buffer_config) && owner.buffer_config&.flush_at_shutdown + # When `flush_at_shutdown` is `true`, the remaining chunk files during resuming are possibly broken + # since there may be a power failure or similar failure. + log.warn { "restoring buffer file: path = #{path}" } + else + log.debug { "restoring buffer file: path = #{path}" } + end m = new_metadata() # this metadata will be overwritten by resuming .meta file content # so it should not added into @metadata_list for now diff --git a/lib/fluent/plugin/buf_file_single.rb b/lib/fluent/plugin/buf_file_single.rb index 225447063e..1d974962a7 100644 --- a/lib/fluent/plugin/buf_file_single.rb +++ b/lib/fluent/plugin/buf_file_single.rb @@ -166,7 +166,13 @@ def resume Dir.glob(escaped_patterns(patterns)) do |path| next unless File.file?(path) - log.debug { "restoring buffer file: path = #{path}" } + if owner.respond_to?(:buffer_config) && owner.buffer_config&.flush_at_shutdown + # When `flush_at_shutdown` is `true`, the remaining chunk files during resuming are possibly broken + # since there may be a power failure or similar failure. + log.warn { "restoring buffer file: path = #{path}" } + else + log.debug { "restoring buffer file: path = #{path}" } + end m = new_metadata() # this metadata will be updated in FileSingleChunk.new mode = Fluent::Plugin::Buffer::FileSingleChunk.assume_chunk_state(path)