Class: Fluent::CloudwatchInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_cloudwatch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCloudwatchInput

Returns a new instance of CloudwatchInput.



34
35
36
37
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 34

def initialize
  super
  require 'aws-sdk-v1'
end

Instance Attribute Details

#dimensionsObject

Returns the value of attribute dimensions.



32
33
34
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 32

def dimensions
  @dimensions
end

Instance Method Details

#configure(conf) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 39

def configure(conf)
  super

  @dimensions = []
  if @dimensions_name && @dimensions_value
    names = @dimensions_name.split(",").each
    values = @dimensions_value.split(",").each
    loop do
      @dimensions.push({
        :name => names.next,
        :value => values.next,
      })
    end
  else
    @dimensions.push({
      :name => @dimensions_name,
      :value => @dimensions_value,
    })
  end

  AWS.config(
    :http_open_timeout => @open_timeout,
    :http_read_timeout => @read_timeout,
  )
end

#shutdownObject



75
76
77
78
79
80
81
82
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 75

def shutdown
  super
  @running = false
  @watcher.terminate
  @monitor.terminate
  @watcher.join
  @monitor.join
end

#startObject



65
66
67
68
69
70
71
72
73
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 65

def start
  super

  @running = true
  @updated = Time.now
  @watcher = Thread.new(&method(:watch))
  @monitor = Thread.new(&method(:monitor))
  @mutex   = Mutex.new
end