Class: Fluent::Plugin::BinInput

Inherits:
TailInput
  • Object
show all
Defined in:
lib/fluent/plugin/in_bin.rb

Defined Under Namespace

Classes: TailWatcher

Instance Method Summary collapse

Instance Method Details

#convert_line_to_event(line, es, tail_watcher) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fluent/plugin/in_bin.rb', line 25

def convert_line_to_event(line, es, tail_watcher)
  begin
    es.add(nil, line)
  rescue => e
    log.warn line.dump, error: e.to_s
    log.debug_backtrace(e.backtrace)
  end
end

#setup_watcher(path, pe) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/fluent/plugin/in_bin.rb', line 34

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.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)
  end
  tw
end