class Fluent::Plugin::MultiFormatParser

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/parser_multi_format.rb, line 8
def initialize
  super

  @parsers = []
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/parser_multi_format.rb, line 14
def configure(conf)
  super

  conf.elements.each { |e|
    next unless ['pattern', 'format'].include?(e.name)
    next if e['format'].nil? && (e['@type'] == 'multi_format')

    parser = Plugin.new_parser(e['format'])
    parser.configure(e)
    @parsers << parser
  }
end
parse(text) { |time, record| ... } click to toggle source
# File lib/fluent/plugin/parser_multi_format.rb, line 27
def parse(text)
  @parsers.each { |parser|
    begin
      parser.parse(text) { |time, record|
        if time && record
          yield time, record
          return
        end
      }
    rescue # ignore parser error
    end
  }

  yield nil, nil
end