lib/fluent/plugin/ec2_metadata.rb in fluent-plugin-ec2-metadata-0.0.12 vs lib/fluent/plugin/ec2_metadata.rb in fluent-plugin-ec2-metadata-0.0.13

- old
+ new

@@ -13,23 +13,22 @@ # <record></record> directive @map = {} conf.elements.select { |element| element.name == 'record' }.each { |element| element.each_pair { |k, v| - element.has_key?(k) @map[k] = v } } @placeholder_expander = PlaceholderExpander.new # get metadata first and then setup a refresh thread @ec2_metadata = Hash.new - set_metadata + set_metadata set_tag @refresh_thread = Thread.new { - while true + while true sleep @metadata_refresh_seconds set_metadata set_tag end } @@ -142,10 +141,10 @@ @placeholders = placeholders end def expand(str) - str.gsub(/(\${[a-z_]+(\[-?[0-9]+\])?}|__[A-Z_]+__)/) { + str.gsub(/(\${[a-z_:\-]+(\[-?[0-9]+\])?}|__[A-Z_]+__)/) { $log.warn "ec2-metadata: unknown placeholder `#{$1}` found in a tag `#{@placeholders['${tag}']}`" unless @placeholders.include?($1) @placeholders[$1] } end end