diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 446e3c427d..0766f108fb 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -930,6 +930,8 @@ def bytesize end class IOHandler + BYTES_TO_READ = 8192 + def initialize(watcher, path:, read_lines_limit:, read_bytes_limit_per_second:, log:, open_on_every_update:, from_encoding: nil, encoding: nil, &receive_lines) @watcher = watcher @path = path @@ -974,10 +976,10 @@ def handle_notify if !io.nil? && @lines.empty? begin while true - @fifo << io.readpartial(8192, @iobuf) + @fifo << io.readpartial(BYTES_TO_READ, @iobuf) @fifo.read_lines(@lines) - number_bytes_read += 8192 + number_bytes_read += BYTES_TO_READ limit_bytes_per_second_reached = (number_bytes_read >= @read_bytes_limit_per_second && @read_bytes_limit_per_second > 0) @log.debug("reading file: #{@path}") if @lines.size >= @read_lines_limit || limit_bytes_per_second_reached