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 +4 -4
- data/lib/logstash/inputs/cloudwatch.rb +8 -4
- data/logstash-input-cloudwatch.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19f8076571146fdd2d9389da822af98a1bd4c39c
|
4
|
+
data.tar.gz: 629b32cc06fe2b35ff42b9e946958c4002486efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
@
|
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
|
-
@
|
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
|
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"
|