lib/fluent/plugin/out_forest.rb in fluent-plugin-forest-0.2.0 vs lib/fluent/plugin/out_forest.rb in fluent-plugin-forest-0.2.1

- old
+ new

@@ -3,10 +3,11 @@ config_param :subtype, :string config_param :remove_prefix, :string, :default => nil config_param :add_prefix, :string, :default => nil config_param :hostname, :string, :default => `hostname`.chomp + config_param :escape_tag_separator, :string, :default => '_' attr_reader :outputs def configure(conf) super @@ -58,11 +59,13 @@ output.shutdown end end def parameter(tag, e, name = 'instance', arg = '') + escaped_tag = tag.gsub('.', @escape_tag_separator) pairs = {} e.each do |k,v| + v = v.gsub('__ESCAPED_TAG__', escaped_tag).gsub('${escaped_tag}', escaped_tag) pairs[k] = v.gsub('__TAG__', tag).gsub('${tag}', tag).gsub('__HOSTNAME__', @hostname).gsub('${hostname}', @hostname) end elements = e.elements.map do |child| parameter(tag, child, child.name, child.arg) end