Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/fluent/plugin/out_influxdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Fluent::Plugin::InfluxdbOutput < Fluent::Plugin::Output
desc: "Use SSL when connecting to influxDB."
config_param :verify_ssl, :bool, default: true,
desc: "Enable/Disable SSL Certs verification when connecting to influxDB via SSL."
config_param :keys_mapping, :hash, :default => {},
desc: "The names of the keys mapping to map existing tags to those from influxDB."
config_param :auto_tags, :bool, default: false,
desc: "Enable/Disable auto-tagging behaviour which makes strings tags."
config_param :tag_keys, :array, default: [],
Expand Down Expand Up @@ -127,13 +129,14 @@ def write(chunk)
tag = chunk.metadata.tag
chunk.msgpack_each do |time, record|
timestamp = record.delete(@time_key) || time
if tag_keys.empty? && !@auto_tags
if @tag_keys.empty? && !@auto_tags && @keys_mapping.empty?
values = record
tags = {}
else
values = {}
tags = {}
record.each_pair do |k, v|
k = @keys_mapping.fetch(k, k)
if (@auto_tags && v.is_a?(String)) || @tag_keys.include?(k)
# If the tag value is not nil, empty, or a space, add the tag
if v.to_s.strip != ''
Expand Down