diff --git a/lib/fluent/plugin/in_bin.rb b/lib/fluent/plugin/in_bin.rb index ce49a56a1a399501769d5657df6635ddff38a56c..b9f062dad8feb4d2e5b7703f90e561bbd8a187d7 100644 --- a/lib/fluent/plugin/in_bin.rb +++ b/lib/fluent/plugin/in_bin.rb @@ -33,7 +33,7 @@ module Fluent::Plugin def setup_watcher(path, pe) line_buffer_timer_flusher = (@multiline_mode && @multiline_flush_interval) ? TailWatcher::LineBufferTimerFlusher.new(log, @multiline_flush_interval, &method(:flush_buffer)) : nil - tw = TailWatcher.new(path, @rotate_wait, pe, log, @read_from_head, @enable_watch_timer, @read_lines_limit, method(:update_watcher), line_buffer_timer_flusher, &method(:receive_lines)) + tw = TailWatcher.new(path, @rotate_wait, pe, log, @read_from_head, @enable_watch_timer, @read_lines_limit, method(:update_watcher), line_buffer_timer_flusher, @from_encoding, @encoding, open_on_every_update, &method(:receive_lines)) tw.attach do |watcher| timer_execute(:in_tail_timer_trigger, 1, &watcher.method(:on_notify)) if watcher.enable_watch_timer event_loop_attach(watcher.stat_trigger) @@ -42,7 +42,8 @@ module Fluent::Plugin end class TailWatcher < TailInput::TailWatcher - def on_rotate(io) + def on_rotate(stat) + io = Fluent::FileWrapper.open(@path) if @io_handler == nil if io # first time