Class: Fluent::NewTailPathInput
- Inherits:
-
NewTailInput
- Object
- NewTailInput
- Fluent::NewTailPathInput
- Defined in:
- lib/fluent/plugin/in_tail_path.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#convert_line_to_event(line, es, tail_watcher) ⇒ Object
Override to add path field.
-
#parse_multilines(lines, tail_watcher) ⇒ Object
Override to pass tail_watcher to convert_line_to_event.
-
#parse_singleline(lines, tail_watcher) ⇒ Object
Override to pass tail_watcher to convert_line_to_event.
Instance Method Details
#configure(conf) ⇒ Object
8 9 10 |
# File 'lib/fluent/plugin/in_tail_path.rb', line 8 def configure(conf) super end |
#convert_line_to_event(line, es, tail_watcher) ⇒ Object
Override to add path field
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fluent/plugin/in_tail_path.rb', line 13 def convert_line_to_event(line, es, tail_watcher) begin line.chomp! # remove \n time, record = parse_line(line) if time && record record[@path_key] ||= tail_watcher.path unless @path_key.nil? es.add(time, record) else log.warn "pattern not match: #{line.inspect}" end rescue => e log.warn line.dump, :error => e.to_s log.debug_backtrace(e) end end |
#parse_multilines(lines, tail_watcher) ⇒ Object
Override to pass tail_watcher to convert_line_to_event
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fluent/plugin/in_tail_path.rb', line 39 def parse_multilines(lines, tail_watcher) lb = tail_watcher.line_buffer es = ::Fluent::MultiEventStream.new lines.each { |line| if @parser.parser.firstline?(line) if lb convert_line_to_event(lb, es, tail_watcher) end lb = line else if lb.nil? log.warn "got incomplete line before first line from #{tail_watcher.path}: #{lb.inspect}" else lb << line end end } tail_watcher.line_buffer = lb es end |
#parse_singleline(lines, tail_watcher) ⇒ Object
Override to pass tail_watcher to convert_line_to_event
30 31 32 33 34 35 36 |
# File 'lib/fluent/plugin/in_tail_path.rb', line 30 def parse_singleline(lines, tail_watcher) es = ::Fluent::MultiEventStream.new lines.each { |line| convert_line_to_event(line, es, tail_watcher) } es end |