logstash-output-elasticsearch_groom 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b38f3fe9fb76e53deacdf9ee02b0cc26bde5b56d
|
4
|
+
data.tar.gz: 6882873d433b39784ba16a3765a041cba475af57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac6b7d069ca1b04b4ad266a9c454b6f804964465402919a767fbe2033c9027faf8572d7c3a13afbdac853f2f8a5dd4982ba7fd778b44e951fd350782872fcd91
|
7
|
+
data.tar.gz: 53d7dd0ee85e43a6d6184776a9399322c29545c140eeb31e04c15877680b11b5ef248cc3b5de44e22ad412fd99691b4a0a7bae31828dc5f774641d3dab5d494b
|
@@ -150,9 +150,15 @@ class LogStash::Outputs::ElasticsearchGroom < LogStash::Outputs::Base
|
|
150
150
|
needs_grooming = candidates.find_all do |i|
|
151
151
|
|
152
152
|
if (match_data = index_parse_regex.match(i))
|
153
|
-
|
154
|
-
|
155
|
-
|
153
|
+
date_part = match_data[1]
|
154
|
+
begin
|
155
|
+
index_dt = dt_format.parseDateTime date_part
|
156
|
+
@logger.debug? and @logger.debug "Parsed DateTime of #{i} is #{index_dt}"
|
157
|
+
next index_dt.isBefore abs_cutoff_dt
|
158
|
+
rescue java.lang.IllegalArgumentException => e
|
159
|
+
@logger.warn "Unable to parse date from #{date_part} part of #{i}"
|
160
|
+
false
|
161
|
+
end
|
156
162
|
end
|
157
163
|
|
158
164
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch_groom'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.3'
|
4
4
|
s.licenses = ["Apache License (2.0)"]
|
5
5
|
s.summary = "Grooms time-series Elastichsearch indices."
|
6
6
|
s.description = "A logstash output plugin that will perform event triggered grooming (aka pruning) of time-series indices especially those created by logstash-output-elasticsearch."
|
@@ -59,4 +59,21 @@ describe 'outputs/elasticsearch_groom' do
|
|
59
59
|
output.receive event
|
60
60
|
|
61
61
|
end
|
62
|
+
|
63
|
+
it 'should handle non-date matches' do
|
64
|
+
output = outputClass.new('action' => 'delete', 'age_cutoff' => '4w', 'index' => '.marvel-%{+YYYY.MM.dd}')
|
65
|
+
output.register
|
66
|
+
|
67
|
+
event = LogStash::Event.new('@timestamp' => '2015-03-15T00:00:00')
|
68
|
+
|
69
|
+
expect(es_accessor).to receive(:matching_indices)
|
70
|
+
.with('.marvel-*', 'open')
|
71
|
+
.and_return(%w(.marvel-2015.02.12 .marvel-kibana))
|
72
|
+
expect(es_accessor).not_to receive(:close_indices)
|
73
|
+
expect(es_accessor).to receive(:delete_indices)
|
74
|
+
.with(%w(.marvel-2015.02.12))
|
75
|
+
.once
|
76
|
+
output.receive event
|
77
|
+
|
78
|
+
end
|
62
79
|
end
|