Class: Fluent::ConditionalFilterOutput

Inherits:
Output
  • Object
show all
Includes:
HandleTagNameMixin
Defined in:
lib/fluent/plugin/out_conditional_filter.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fluent/plugin/out_conditional_filter.rb', line 10

def configure(conf)
  super

  not_configured_params = %w[key_pattern condition filter].select { |p| !send(p.to_sym) }
  if not_configured_params.any?
    raise Fluent::ConfigError(
      "[out_conditional_filter] missing mandatory parameter: #{not_configured_params.join(',')}"
    )
  end

  @key_pattern_regexp = /#{key_pattern}/
end

#emit(tag, es, chain) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fluent/plugin/out_conditional_filter.rb', line 23

def emit(tag, es, chain)
  es.each do |time, record|
    t = tag.dup
    record = filter_record(t, time, record)

    if record.any?
      Fluent::Engine.emit(t, time, record)
    end
  end

  chain.next
end