Sha256: 3adf1e4420cc91fc1880fc9367bb9077ad3ed228f695c3a566d3100628027c43
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
class Fluent::DeparserFilter < Fluent::Filter Fluent::Plugin.register_filter('deparser', self) config_param :format, :string config_param :format_key_names, :string config_param :key_name, :string, default: 'message' config_param :reserve_data, :bool, default: false 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 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 end
Version data entries
3 entries across 3 versions & 2 rubygems