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.



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

def initialize
  super
end

Instance Attribute Details

#dimensionsObject

Returns the value of attribute dimensions.



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

def dimensions
  @dimensions
end

Instance Method Details

#configure(conf) ⇒ Object



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
69
70
71
72
73
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 43

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

  if !@region
    @region = @cw_endpoint.split('.')[1]
  end
end

#shutdownObject



85
86
87
88
89
90
91
92
# File 'lib/fluent/plugin/in_cloudwatch.rb', line 85

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

#startObject



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

def start
  super

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