Class: Fluent::Plugin::NumComparisonFilter
- Inherits:
-
Filter
- Object
- Filter
- Fluent::Plugin::NumComparisonFilter
- Defined in:
- lib/fluent/plugin/filter_num_comparison.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
28 29 30 31 32 33 |
# 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) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# 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 |