Class: Fluent::DeparserFilter
- Inherits:
-
Filter
- Object
- Filter
- Fluent::DeparserFilter
- Defined in:
- lib/fluent/plugin/filter_deparser.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fluent/plugin/filter_deparser.rb', line 9 def configure(conf) super @format_key_names = @format_key_names.split(',') begin dummy = @format % (["x"] * @format_key_names.length) rescue ArgumentError raise Fluent::ConfigError, "mismatch between placeholder of format and format_key_names" end end |
#filter_stream(tag, es) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fluent/plugin/filter_deparser.rb', line 20 def filter_stream(tag, es) new_es = Fluent::MultiEventStream.new if @reserve_data es.each {|time,record| new_record = {@key_name => (@format % @format_key_names.map{|k| record[k]})} new_es.add(time, record.merge(new_record)) } else es.each {|time,record| new_record = {@key_name => (@format % @format_key_names.map{|k| record[k]})} new_es.add(time, new_record) } end new_es end |