Class: Fluent::NewTailPathInput::RouterWrap

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(router, path_key) ⇒ RouterWrap

Returns a new instance of RouterWrap.



7
8
9
10
11
# File 'lib/fluent/plugin/in_tail_path.rb', line 7

def initialize(router, path_key)
  @router = router
  @path_key = path_key
  @tail_watcher = nil
end

Instance Attribute Details

#tail_watcherObject

Returns the value of attribute tail_watcher.



5
6
7
# File 'lib/fluent/plugin/in_tail_path.rb', line 5

def tail_watcher
  @tail_watcher
end

Instance Method Details

#emit(tag, time, record) ⇒ Object



13
14
15
16
# File 'lib/fluent/plugin/in_tail_path.rb', line 13

def emit(tag, time, record)
  record[@path_key] = @tail_watcher.path unless @path_key.nil?
  @router.emit(tag, time, record)
end

#emit_array(tag, array) ⇒ Object



18
19
20
# File 'lib/fluent/plugin/in_tail_path.rb', line 18

def emit_array(tag, array)
  @router.emit_array(tag, array)
end

#emit_stream(tag, es) ⇒ Object



22
23
24
25
26
27
# File 'lib/fluent/plugin/in_tail_path.rb', line 22

def emit_stream(tag, es)
  es.each {|time,record|
    record[@path_key] = @tail_watcher.path unless @path_key.nil?
  }
  @router.emit_stream(tag, es)
end