lib/fluent/plugin/out_splunk_hec.rb in fluent-plugin-splunk-enterprise-0.9.1 vs lib/fluent/plugin/out_splunk_hec.rb in fluent-plugin-splunk-enterprise-0.9.2

- old
+ new

@@ -13,16 +13,19 @@ config_param :token, :string # for metadata config_param :default_host, :string, default: nil config_param :host_key, :string, default: nil + config_param :remove_host_key, :bool, default: false config_param :default_source, :string, default: nil config_param :source_key, :string, default: nil + config_param :remove_source_key, :bool, default: false config_param :default_index, :string, default: nil config_param :index_key, :string, default: nil + config_param :remove_index_key, :bool, default: false config_param :sourcetype, :string, default: nil - config_param :use_fluentd_time, :bool, default: true + config_param :use_fluentd_time, :bool, default: true # for Indexer acknowledgement config_param :use_ack, :bool, default: false config_param :channel, :string, default: nil config_param :ack_interval, :integer, default: 1 @@ -101,22 +104,22 @@ # metadata msg['sourcetype'] = @sourcetype if @sourcetype if record[@host_key] - msg['host'] = record[@host_key] + msg['host'] = @remove_host_key ? record.delete(@host_key) : record[@host_key] elsif @default_host msg['host'] = @default_host end if record[@source_key] - msg['source'] = record[@source_key] + msg['source'] = @remove_source_key ? record.delete(@source_key) : record[@source_key] elsif @default_source msg['source'] = @default_source end if record[@index_key] - msg['index'] = record[@index_key] + msg['index'] = @remove_index_key ? record.delete(@index_key) : record[@index_key] elsif @default_index msg['index'] = @default_index end res = Yajl.dump(msg)