Class: Fluent::HasKeysFilter

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

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



8
9
10
11
# File 'lib/fluent/plugin/filter_has_keys.rb', line 8

def configure(conf)
  super
  @essential_keys = @keys ? @keys.split(",").map(&:strip) : nil
end

#filter_stream(tag, es) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/fluent/plugin/filter_has_keys.rb', line 21

def filter_stream(tag, es)
  new_es = MultiEventStream.new
  es.each do |time, record|
    if @essential_keys.nil? or @essential_keys.all? {|k| record.has_key?(k) }
        new_es.add(time, record)
    end
  end
  return new_es
end

#shutdownObject



17
18
19
# File 'lib/fluent/plugin/filter_has_keys.rb', line 17

def shutdown
  super
end

#startObject



13
14
15
# File 'lib/fluent/plugin/filter_has_keys.rb', line 13

def start
  super
end