Module: Fluent::EC2Metadata

Included in:
Plugin::EC2MetadataFilter, Plugin::EC2MetadataOutput
Defined in:
lib/fluent/plugin/ec2_metadata.rb

Defined Under Namespace

Classes: PlaceholderExpander

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fluent/plugin/ec2_metadata.rb', line 11

def configure(conf)
  super

  # <record></record> directive
  @map = {}
  conf.elements.select { |element| element.name == 'record' }.each { |element|
    element.each_pair { |k, v|
      element.has_key?(k) # to suppress unread configuration warning
      @map[k] = v
    }
  }

  @placeholder_expander = PlaceholderExpander.new(log)

  # get metadata first and then setup a refresh thread
  @ec2_metadata = 
  @refresh_thread = Thread.new {
    while true
      sleep @metadata_refresh_seconds
      @ec2_metadata = 
    end
  }
end

#initializeObject



4
5
6
7
8
9
# File 'lib/fluent/plugin/ec2_metadata.rb', line 4

def initialize
  super
  require 'net/http'
  require 'aws-sdk-ec2'
  require 'oj'
end