class Fluent::Plugin::NumComparisonFilter
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_num_comparison.rb, line 28 def configure(conf) super @record_key = @record_key.to_s @threshold = @threshold.to_i @inequality_flag = @inequality == "smaller" ? 0 : 1 end
filter_stream(tag, es)
click to toggle source
# File lib/fluent/plugin/filter_num_comparison.rb, line 35 def filter_stream(tag, es) new_es = Fluent::MultiEventStream.new es.each do |time, record| if @inequality_flag == 0 if record[@record_key].to_i < @threshold new_es.add(time, record) end else if record[@record_key].to_i > @threshold new_es.add(time, record) end end end new_es end