diff --git a/lib/fluent/plugin/out_influxdb.rb b/lib/fluent/plugin/out_influxdb.rb index 9aed2a4..b6f1751 100644 --- a/lib/fluent/plugin/out_influxdb.rb +++ b/lib/fluent/plugin/out_influxdb.rb @@ -138,14 +138,7 @@ def write(chunk) values = {} tags = {} record.each_pair do |k, v| - 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 != '' - tags[k] = v - end - else - values[k] = v - end + _parse_field(k, v, tags, values) end end if @sequence_tag @@ -204,6 +197,21 @@ def write(chunk) end end + def _parse_field(k, v, tags, values) + 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 != '' + tags[k] = v + end + elsif v.is_a?(Hash) + v.each_pair do |nested_k, nested_v| + _parse_field("#{k}.#{nested_k}", nested_v, tags, values) + end + else + values[k] = v + end + end + def time_precise_lambda() case @time_precision.to_sym when :h then