logstash-output-elasticsearch_groom 0.1.2 → 0.1.3

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: 2b9115080c650ad17374f923d63c6a6c98baaa17
4
- data.tar.gz: 954271f0ec4a044425eaff23bdd670e3d2d2cc46
3
+ metadata.gz: b38f3fe9fb76e53deacdf9ee02b0cc26bde5b56d
4
+ data.tar.gz: 6882873d433b39784ba16a3765a041cba475af57
5
5
  SHA512:
6
- metadata.gz: c20f425e2a951bcd60d065c5866725cab545cab3ad7dd1c8c25a69ea37ef7b539ff6a757673eb6f4df0f4b220a0959f4bf6b6977f11c56777b2479669956e8e3
7
- data.tar.gz: 99e5519f3334b60b49c74e4aa1418db6d356f75709811e3964d953b4244f0bd0ff2fe2769ae234cda93563b4602b496186b141b03ae66082742c761a047902ca
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
- index_dt = dt_format.parseDateTime match_data[1]
154
- @logger.debug? and @logger.debug "Parsed DateTime of #{i} is #{index_dt}"
155
- next index_dt.isBefore abs_cutoff_dt
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.2'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch_groom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Bourne