logstash-input-elasticache 0.2.10 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/inputs/elasticache.rb +28 -3
- data/logstash-input-elasticache.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b293f0027b99f3844f2183bd30efbe1ee9c197a0e099ce4407fc0d41ac4ebcc8
|
4
|
+
data.tar.gz: 182293b263ff5027fc7ae99eac52533aa8beef28f89566150e710d7ace6f5507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65e11c26d01eaa764a778edc0141151a7c69406328d591f0676dbf9847705211e976ed8bf62418e5e8329c68b4a5399bcda249eb8930145d1f673e31fec677f4
|
7
|
+
data.tar.gz: a7bbe5641232af2c34fbc631052c398c2f526cac31318caa445d3135072cadcd6f4a83f88cd0608ca86e3fa2d2404ec67f40336582911f4b39e03526bec4cf64
|
@@ -18,12 +18,15 @@ class LogStash::Inputs::ElastiCache < LogStash::Inputs::Base
|
|
18
18
|
config :source_type, :validate => :string, :required => true
|
19
19
|
config :source_name, :validate => :string, :required => true
|
20
20
|
config :polling_frequency, :validate => :number, :default => 600
|
21
|
+
config :sincedb_path, :validate => :string, :default => nil
|
21
22
|
|
22
23
|
def register
|
23
24
|
require "aws-sdk"
|
24
25
|
@logger.info "Registering ElastiCache input", :region => @region, :source_type => @source_type, :source_name => @source_name
|
25
26
|
@elasticache = Aws::ElastiCache::Client.new aws_options_hash
|
26
|
-
|
27
|
+
|
28
|
+
path = @sincedb_path || File.join(ENV["HOME"], ".sincedb_" + Digest::MD5.hexdigest("#{@source_type}+#{@source_name}"))
|
29
|
+
@sincedb = SinceDB::File.new path
|
27
30
|
end
|
28
31
|
|
29
32
|
def run(queue)
|
@@ -38,7 +41,7 @@ class LogStash::Inputs::ElastiCache < LogStash::Inputs::Base
|
|
38
41
|
response = @elasticache.describe_events({
|
39
42
|
source_identifier: @source_name,
|
40
43
|
source_type: @source_type,
|
41
|
-
start_time: @
|
44
|
+
start_time: @sincedb.read,
|
42
45
|
end_time: checkpoint,
|
43
46
|
marker: marker,
|
44
47
|
})
|
@@ -47,7 +50,7 @@ class LogStash::Inputs::ElastiCache < LogStash::Inputs::Base
|
|
47
50
|
more = response[:marker]
|
48
51
|
marker = response[:marker]
|
49
52
|
end
|
50
|
-
@
|
53
|
+
@sincedb.write checkpoint
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|
@@ -82,4 +85,26 @@ class LogStash::Inputs::ElastiCache < LogStash::Inputs::Base
|
|
82
85
|
@logger.debug "shipping #{event} to #{queue}"
|
83
86
|
queue << event
|
84
87
|
end
|
88
|
+
|
89
|
+
private
|
90
|
+
module SinceDB
|
91
|
+
class File
|
92
|
+
def initialize(file)
|
93
|
+
@db = file
|
94
|
+
end
|
95
|
+
|
96
|
+
def read
|
97
|
+
if ::File.exists?(@db)
|
98
|
+
content = ::File.read(@db).chomp.strip
|
99
|
+
return content.empty? ? Time.new : Time.parse(content)
|
100
|
+
else
|
101
|
+
return DateTime.now - 13
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def write(time)
|
106
|
+
::File.open(@db, 'w') { |file| file.write time.to_s }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
85
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-elasticache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Schleifer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|