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
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/out_filter_keys.rb', line 20 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
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fluent/plugin/out_filter_keys.rb', line 32 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) router.emit(t, time, record) else router.emit("#{DISCARD_TAG}.#{t}", time, record) if @add_tag_and_reemit end } chain.next end |
#filter_record(tag, time, record) ⇒ Object
46 47 48 |
# File 'lib/fluent/plugin/out_filter_keys.rb', line 46 def filter_record(tag, time, record) super(tag, time, record) end |