class Fluent::Plugin::OnekeyparseFilter
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_onekeyparse.rb, line 28 def configure(conf) super @reg = Regexp.new(conf['in_format'], Regexp::IGNORECASE) end
filter(tag, time, record)
click to toggle source
# File lib/fluent/plugin/filter_onekeyparse.rb, line 33 def filter(tag, time, record) m = @reg.match(record[@in_key]) unless m nil return end hash = m.named_captures record = {} @out_record_keys.split(",").each do | key | record[key] = hash.has_key?(key) ? hash[key] : nil end record end
filter_stream(tag, es)
click to toggle source
# File lib/fluent/plugin/filter_onekeyparse.rb, line 48 def filter_stream(tag, es) new_es = MultiEventStream.new es.each { |time, record| begin filtered_record = filter(tag, time, record) new_es.add(time, filtered_record) if filtered_record rescue => e router.emit_error_event(tag, time, record, e) end } new_es end