Class: Fluent::Plugin::ArraySpinFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_array_spin.rb

Instance Method Summary collapse

Instance Method Details

#filter_stream(tag, es) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fluent/plugin/filter_array_spin.rb', line 17

def filter_stream(tag, es)
  new_es = Fluent::MultiEventStream.new
  
  es.each do |time, record|
    record[@key_name].each do |r|
      new_record = record.clone
      
      if r.is_a?(Hash) then
        new_record.update(r)
      else
        new_record[@hash_value_field] = r.clone
      end
      
      if !@reserve_key then
        new_record.delete(@key_name)
      end
      
      new_es.add(time, new_record)
    end
  end
  
  new_es
end