Class: Fluent::FilterKeysOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::FilterKeysOutput
- Includes:
- HandleTagNameMixin
- Defined in:
- lib/fluent/plugin/out_filter_keys.rb
Constant Summary collapse
- DISCARD_TAG =
'discarded'
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fluent/plugin/out_filter_keys.rb', line 15 def configure(conf) super if (ensure_keys && denied_keys) || (ensure_keys.nil? && denied_keys.nil?) raise ConfigError, "filter_keys: Either ensure_keys or denied_keys are required to be set." end @ensure_keys = ensure_keys && ensure_keys.split(/\s*,\s*/) @denied_keys = denied_keys && denied_keys.split(/\s*,\s*/) end |
#emit(tag, es, chain) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/out_filter_keys.rb', line 27 def emit(tag, es, chain) es.each { |time, record| t = tag.dup filter_record(t, time, record) if ensure_keys_in?(record) || denied_keys_not_in?(record) Engine.emit(t, time, record) else Engine.emit("#{DISCARD_TAG}.#{t}", time, record) if @add_tag_and_reemit end } chain.next end |
#filter_record(tag, time, record) ⇒ Object
41 42 43 |
# File 'lib/fluent/plugin/out_filter_keys.rb', line 41 def filter_record(tag, time, record) super(tag, time, record) end |