Class: FluentExt::TextParser::RegexpParser
- Inherits:
-
GenericParser
- Object
- GenericParser
- FluentExt::TextParser::RegexpParser
- Includes:
- Fluent::Configurable
- Defined in:
- lib/fluent/plugin/fixed_parser.rb
Instance Method Summary collapse
- #call(text) ⇒ Object
-
#initialize(regexp, conf = {}) ⇒ RegexpParser
constructor
A new instance of RegexpParser.
Methods inherited from GenericParser
Constructor Details
#initialize(regexp, conf = {}) ⇒ RegexpParser
Returns a new instance of RegexpParser.
58 59 60 61 62 63 64 |
# File 'lib/fluent/plugin/fixed_parser.rb', line 58 def initialize(regexp, conf={}) super() @regexp = regexp unless conf.empty? configure(conf) end end |
Instance Method Details
#call(text) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/fluent/plugin/fixed_parser.rb', line 66 def call(text) m = @regexp.match(text) unless m unless @suppress_parse_error_log $log.warn "pattern not match: #{text}" end return nil, nil end record = {} m.names.each {|name| record[name] = m[name] if m[name] } parse_time(record) end |