Class: Fluent::Plugin::RecordSplitterOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::RecordSplitterOutput
- Includes:
- Mixin::ConfigPlaceholders, Mixin::RewriteTagName, HandleTagNameMixin, SetTagKeyMixin
- Defined in:
- lib/fluent/plugin/out_record_splitter.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/out_record_splitter.rb', line 28 def configure(conf) super if !@keep_keys.empty? && !@remove_keys.empty? raise Fluent::ConfigError, 'Cannot set both keep_keys and remove_keys.' end if @keep_other_key && !@keep_keys.empty? raise Fluent::ConfigError, 'Cannot set keep_keys when keep_other_key is true.' end if !@keep_other_key && !@remove_keys.empty? raise Fluent::ConfigError, 'Cannot set remove_keys when keep_other_key is false.' end end |
#multi_workers_ready? ⇒ Boolean
24 25 26 |
# File 'lib/fluent/plugin/out_record_splitter.rb', line 24 def multi_workers_ready? true end |
#process(tag, es) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fluent/plugin/out_record_splitter.rb', line 41 def process(tag, es) emit_tag = tag.dup es.each do |time, record| filter_record(emit_tag, time, record) if @keep_other_key common = record.reject do |key, _value| key == @split_key || @remove_keys.include?(key) end else common = record.select { |key, _value| @keep_keys.include?(key) } end next unless record.key?(@split_key) record[@split_key].each do |v| v.merge!(common) unless common.empty? router.emit(emit_tag, time, v) end end end |