logstash-output-elasticsearch_groom 0.1.1 → 0.1.2

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: 572182b0e882b6216332343092806f1444dca57e
4
- data.tar.gz: 6a8d23c1889ca80591e56205a28a431b565ecf72
3
+ metadata.gz: 2b9115080c650ad17374f923d63c6a6c98baaa17
4
+ data.tar.gz: 954271f0ec4a044425eaff23bdd670e3d2d2cc46
5
5
  SHA512:
6
- metadata.gz: 10adaacb5004ff852d175b2c1a71deea3c17b6cfe81b2e4a5a54b2cfcba26cec52b718d68059da44322b29606bba0824af903cf1b6f2d9ba0fad24520d07caaa
7
- data.tar.gz: 05208d886fedeb73454205b7d8cd7ab67073d96204c5ae7398048588b98ce9f1b6a441ca1692c7569a6ffbbd27503c4f4d07a463784672010a0514266fc57d0e
6
+ metadata.gz: c20f425e2a951bcd60d065c5866725cab545cab3ad7dd1c8c25a69ea37ef7b539ff6a757673eb6f4df0f4b220a0959f4bf6b6977f11c56777b2479669956e8e3
7
+ data.tar.gz: 99e5519f3334b60b49c74e4aa1418db6d356f75709811e3964d953b4244f0bd0ff2fe2769ae234cda93563b4602b496186b141b03ae66082742c761a047902ca
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Logstash Plugin
1
+ # Elasticsearch Groom Logstash Output Plugin
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/logstash-output-elasticsearch_groom.svg)](http://badge.fury.io/rb/logstash-output-elasticsearch_groom)
4
+
5
+ [![Circle CI](https://circleci.com/gh/itzg/logstash-output-elasticsearch-groom.svg?style=svg)](https://circleci.com/gh/itzg/logstash-output-elasticsearch-groom)
2
6
 
3
7
  This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
4
8
 
@@ -83,4 +87,4 @@ Programming is not a required skill. Whatever you've seen about open source and
83
87
 
84
88
  It is more important to the community that you are able to contribute.
85
89
 
86
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
90
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
@@ -105,7 +105,7 @@ class LogStash::Outputs::ElasticsearchGroom < LogStash::Outputs::Base
105
105
  def receive(event)
106
106
  return unless output?(event)
107
107
 
108
- ts_wildcarded = @index.gsub /%{\+.+}/, '*'
108
+ ts_wildcarded = @index.gsub /%{\+[^}]+}/, '*'
109
109
  ts_wildcarded = event.sprintf ts_wildcarded
110
110
 
111
111
  resolved_scope = event.sprintf(@scope)
@@ -115,7 +115,7 @@ class LogStash::Outputs::ElasticsearchGroom < LogStash::Outputs::Base
115
115
  @logger.debug? and @logger.debug "Starting with #{candidates}"
116
116
 
117
117
  groomed = []
118
- if (ts_bit_matched = @index.match /%{\+(.+)}/)
118
+ if (ts_bit_matched = @index.match /%{\+([^}]+)}/)
119
119
  groomed = groom_by_time(event, candidates, ts_bit_matched)
120
120
  else
121
121
  @logger.warn "Only 'index' with a timestamp placeholder is supported. Instead had #{resolvedIndex}"
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch_groom'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
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."
@@ -42,4 +42,21 @@ describe 'outputs/elasticsearch_groom' do
42
42
  output.receive event
43
43
 
44
44
  end
45
+
46
+ it 'should handle an index with field references also' do
47
+ output = outputClass.new('action' => 'delete', 'age_cutoff' => '4w', 'index' => 'logstash-%{+YYYY.MM.dd}-%{subtype}')
48
+ output.register
49
+
50
+ event = LogStash::Event.new('@timestamp' => '2015-03-15T00:00:00', 'subtype' => 'logs')
51
+
52
+ expect(es_accessor).to receive(:matching_indices)
53
+ .with('logstash-*-logs', 'open')
54
+ .and_return(%w(logstash-2015.03.12-logs logstash-2015.02.13-logs logstash-2015.02.12-logs))
55
+ expect(es_accessor).not_to receive(:close_indices)
56
+ expect(es_accessor).to receive(:delete_indices)
57
+ .with(%w(logstash-2015.02.13-logs logstash-2015.02.12-logs))
58
+ .once
59
+ output.receive event
60
+
61
+ end
45
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch_groom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Bourne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-12 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jar-dependencies