logstash-input-cloudwatch 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ca8079400562640f3ccc4d9cb2db97e79f0f1ee
4
- data.tar.gz: ac7eaf6358e575ca75b70b8897f27bfa95db7436
3
+ metadata.gz: 19f8076571146fdd2d9389da822af98a1bd4c39c
4
+ data.tar.gz: 629b32cc06fe2b35ff42b9e946958c4002486efe
5
5
  SHA512:
6
- metadata.gz: d2e9ffb25fac13a85a12dc7771b3ab325ab0ad42d9431fc902d1e92b1739e22b3e24f453f616499a94add388f50a98e0d2732a2d6bf7ca7767fbd5810155c563
7
- data.tar.gz: 5379f1f46bf773a53c996fe07acad735aa9ba2edf3e574c18bd27641bb561d51f888196b5d1cc7f487817f27e112fdcff27883ac7ee4c47e659735ee4367b3b9
6
+ metadata.gz: 845991221fa1db8357394350eac10506d52e3643e320824be2779021a59d9daa7ace19398a2406aeb7247422acca44567310712b9a343421bb86bea2125a9510
7
+ data.tar.gz: 43a6be158a2383d810ec866ee08258f4f3cd115fa6b16c7a4d3c49abae90fa7aa2be5c0393f0a167687f42dcecc531b0fc0a0e44b4b3d985f9af00210858a333
@@ -94,8 +94,8 @@ class LogStash::Inputs::CloudWatch < LogStash::Inputs::Base
94
94
  Stud.interval(@interval) do
95
95
  @logger.debug('Polling CloudWatch API')
96
96
  # Set up the instance_refresh check
97
- if @instance_refresh > 0
98
- @instances = nil if (Time.now - @last_check) > @instance_refresh
97
+ if @instance_refresh > 0 && (Time.now - @last_check) > @instance_refresh
98
+ @instances = nil
99
99
  @last_check = Time.now
100
100
  end
101
101
 
@@ -108,6 +108,9 @@ class LogStash::Inputs::CloudWatch < LogStash::Inputs::Base
108
108
  event['@timestamp'] = LogStash::Timestamp.new(dp[:timestamp])
109
109
  event['metric'] = metric
110
110
  event['instance'] = instance
111
+ @instance_tags[instance].each do |tag|
112
+ event[tag[:key]] = tag[:value]
113
+ end
111
114
  decorate(event)
112
115
  queue << event
113
116
  end
@@ -154,13 +157,14 @@ class LogStash::Inputs::CloudWatch < LogStash::Inputs::Base
154
157
  def instance_ids
155
158
  return @instances unless @instances.nil?
156
159
 
157
- @instances = []
160
+ @instance_tags = {}
158
161
  @ec2.describe_instances(filters: [ { name: "tag:#{@tag_name}", values: @tag_values } ])[:reservation_set].each do |reservation|
159
162
  @logger.debug reservation
160
163
  reservation[:instances_set].each do |instance|
161
- @instances.push instance[:instance_id]
164
+ @instance_tags[instance[:instance_id]] = instance[:tag_set]
162
165
  end
163
166
  end
167
+ @instances = @instance_tags.keys
164
168
  @logger.debug 'Fetching metrics for the following instances', instances: @instances
165
169
  @instances
166
170
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-cloudwatch'
3
- s.version = '0.2.0'
3
+ s.version = '0.2.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Retrieve stats from AWS CloudWatch."
6
6
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-cloudwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgens du Toit