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.



38
39
40
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 38

def initialize
  super
end

Instance Attribute Details

#dimensionsObject

Returns the value of attribute dimensions.



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

def dimensions
  @dimensions
end

Instance Method Details

#configure(conf) ⇒ Object



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

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
  elsif @dimensions_name || @dimensions_value
    @dimensions.push({
      :name => @dimensions_name,
      :value => @dimensions_value,
    })
  end

  endpoint = URI(@cw_endpoint)
  if endpoint.scheme != "http" && endpoint.scheme != "https"
    @cw_endpoint_uri = "https://#{@cw_endpoint}"
  else
    @cw_endpoint_uri = endpoint.to_s
  end
end

#shutdownObject



80
81
82
83
84
85
86
87
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 80

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

#startObject



70
71
72
73
74
75
76
77
78
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 70

def start
  super

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