logstash-filter-unique 2.0.6 → 3.0.0

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
- SHA1:
3
- metadata.gz: 2b6a8ec28e7337f1d097c5ff99bdf166989a5997
4
- data.tar.gz: 039cc3647436dd6e756d983158accb9210b1ae34
2
+ SHA256:
3
+ metadata.gz: a897481c17326c9535f5dcd010f04bf0cbc42066958ee56c905936f273ebf409
4
+ data.tar.gz: 85b0d726c9a1d5c371ff25cea480c60a5158d5b48bf50ac5d82c24baff953f18
5
5
  SHA512:
6
- metadata.gz: e4afa925560fc1636c501d86868221fea9f240745a77119e4d43b1c43f7077e5ba98874d39ee76602909a338c04bbabf783be09f32c24f811e0d50ddc42d0023
7
- data.tar.gz: 8f10c9de7d2d87b53ed0619b5128df23df6c9c6c5d5f147de60f4084907abab40daee17748ef30b787a3528a62245ddf56d2ebfc9a6d44aaca6694103c36d60b
6
+ metadata.gz: 8fa73bfa2a83881b7e9e01600d502bd5ec2ff0649e27c3bb18fe11f4919abc33be38385ad9926d7a5d8a9c7a4afa0fceaaecd4d1cff7967c17c102f6d9bb74c5
7
+ data.tar.gz: d063c787523c2749c4d234e86177b32763d677dcc1123d7b40cb55d337ca6ce843ce1a5be142c693f5c92ebb2568375411d84ee8620ef9307d1ccf9cd79551c3
@@ -1,12 +1,16 @@
1
+ # 3.0.0
2
+ - Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
3
+
1
4
  ## 2.0.6
2
5
  - Fix some documentation issues
3
6
 
4
- # 2.0.4
7
+ ## 2.0.4
5
8
  - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
6
- # 2.0.3
9
+
10
+ ## 2.0.3
7
11
  - New dependency requirements for logstash-core for the 5.0 release
8
- ## 2.0.0
12
+
13
+ # 2.0.0
9
14
  - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
10
15
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
11
16
  - Dependency on logstash-core update to 2.0
12
-
@@ -3,6 +3,7 @@ reports, or in general have helped logstash along its way.
3
3
 
4
4
  Contributors:
5
5
  * Pere Urbon-Bayes (purbon)
6
+ * Boris Gorbylev (ekho)
6
7
 
7
8
  Note: If you've sent us patches, bug reports, or otherwise contributed to
8
9
  Logstash, and you aren't on the list above and want to be, please let us know
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -39,7 +39,7 @@ filter plugins.
39
39
  &nbsp;
40
40
 
41
41
  [id="plugins-{type}s-{plugin}-fields"]
42
- ===== `fields`
42
+ ===== `fields`
43
43
 
44
44
  * This is a required setting.
45
45
  * Value type is <<array,array>>
@@ -2,9 +2,7 @@
2
2
  require "logstash/filters/base"
3
3
  require "logstash/namespace"
4
4
 
5
-
6
5
  class LogStash::Filters::Unique < LogStash::Filters::Base
7
-
8
6
  config_name "unique"
9
7
 
10
8
  # The fields on which to run the unique filter.
@@ -17,13 +15,11 @@ class LogStash::Filters::Unique < LogStash::Filters::Base
17
15
 
18
16
  public
19
17
  def filter(event)
20
-
21
-
22
18
  @fields.each do |field|
23
- next unless event[field].class == Array
24
-
25
- event[field] = event[field].uniq
19
+ next unless event.include?(field)
20
+ next unless event.get(field).is_a?(Array)
21
+ event.set(field, event.get(field).uniq)
26
22
  end
27
23
  end # def filter
28
24
 
29
- end # class Logstash::Filters::Unique
25
+ end # class LogStash::Filters::Unique
@@ -1,16 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = 'logstash-filter-unique'
3
- s.version = '2.0.6'
4
- s.licenses = ['Apache License (2.0)']
5
- s.summary = "This filter gets the list of unique elements out of an array"
2
+ s.name = 'logstash-filter-unique'
3
+ s.version = '3.0.0'
4
+ s.licenses = ['Apache-2.0']
5
+ s.summary = "This filter gets the list of unique elements out of an array"
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/logstash-plugin install gemname. This gem is not a stand-alone program"
7
- s.authors = ["Elastic"]
8
- s.email = 'info@elastic.co'
9
- s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
7
+ s.authors = ["Elastic"]
8
+ s.email = 'info@elastic.co'
9
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10
10
  s.require_paths = ["lib"]
11
11
 
12
12
  # Files
13
13
  s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
14
+
14
15
  # Tests
15
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
17
 
@@ -18,6 +19,7 @@ Gem::Specification.new do |s|
18
19
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
19
20
 
20
21
  # Gem dependencies
21
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
22
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
23
+
22
24
  s.add_development_dependency 'logstash-devutils'
23
25
  end
@@ -1,30 +1,56 @@
1
- require_relative '../spec_helper'
2
- require 'logstash/filters/unique'
1
+ # encoding: utf-8
2
+
3
+ require "logstash/devutils/rspec/spec_helper"
4
+ require "logstash/filters/unique"
3
5
 
4
6
  describe LogStash::Filters::Unique do
5
7
 
6
- it "should register" do
7
- plugin = LogStash::Plugin.lookup("filter", "unique").new("fields" => [])
8
- expect {plugin.register}.to_not raise_error
8
+ describe "unique on non array should return origin value" do
9
+ # The logstash config goes here.
10
+ # At this time, only filters are supported.
11
+ config <<-CONFIG
12
+ filter {
13
+ unique {
14
+ fields => ["field1"]
15
+ }
16
+ }
17
+ CONFIG
18
+
19
+ sample("field1" => "asdf") do
20
+ insist { subject.get("field1") } == "asdf"
21
+ end
9
22
  end
10
23
 
11
- context "when having an array of elements" do
12
-
13
- let(:plugin) { LogStash::Filters::Unique.new("fields" => "array") }
14
- let(:data) { { "array" => [1,2,1,2,1,2,1,2], "other_field" => "dummy string" }}
15
- let(:event) { LogStash::Event.new(data) }
16
-
17
- before(:each) do
18
- plugin.filter(event)
24
+ describe "unique on array of integers" do
25
+ # The logstash config goes here.
26
+ # At this time, only filters are supported.
27
+ config <<-CONFIG
28
+ filter {
29
+ unique {
30
+ fields => ["field2"]
31
+ }
32
+ }
33
+ CONFIG
34
+
35
+ sample("field2" => [1,2,1,2,1,2,1,2]) do
36
+ insist { subject.get("field2") } == [1,2]
19
37
  end
38
+ end
20
39
 
21
- it "filter all events in the array property" do
22
- expect(event["array"]).to eq([1,2])
23
- end
24
40
 
25
- it "does not touch non filtered properties" do
26
- expect(event["other_field"]).to eq("dummy string")
27
- end
41
+ describe "unique on array of strings" do
42
+ # The logstash config goes here.
43
+ # At this time, only filters are supported.
44
+ config <<-CONFIG
45
+ filter {
46
+ unique {
47
+ fields => ["field3"]
48
+ }
49
+ }
50
+ CONFIG
28
51
 
52
+ sample("field3" => ["a", "b", "c", "c", "d"]) do
53
+ insist { subject.get("field3") } == ["a", "b", "c", "d"]
54
+ end
29
55
  end
30
56
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-unique
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2017-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '1.60'
19
+ - - "<="
17
20
  - !ruby/object:Gem::Version
18
- version: '1.0'
21
+ version: '2.99'
19
22
  name: logstash-core-plugin-api
20
23
  prerelease: false
21
24
  type: :runtime
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1.60'
30
+ - - "<="
25
31
  - !ruby/object:Gem::Version
26
- version: '1.0'
32
+ version: '2.99'
27
33
  - !ruby/object:Gem::Dependency
28
34
  requirement: !ruby/object:Gem::Requirement
29
35
  requirements:
@@ -38,7 +44,9 @@ dependencies:
38
44
  - - ">="
39
45
  - !ruby/object:Gem::Version
40
46
  version: '0'
41
- description: This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program
47
+ description: This gem is a Logstash plugin required to be installed on top of the
48
+ Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
49
+ gem is not a stand-alone program
42
50
  email: info@elastic.co
43
51
  executables: []
44
52
  extensions: []
@@ -46,18 +54,17 @@ extra_rdoc_files: []
46
54
  files:
47
55
  - CHANGELOG.md
48
56
  - CONTRIBUTORS
49
- - DEVELOPER.md
50
57
  - Gemfile
58
+ - LICENSE
51
59
  - NOTICE.TXT
52
60
  - README.md
53
61
  - docs/index.asciidoc
54
62
  - lib/logstash/filters/unique.rb
55
63
  - logstash-filter-unique.gemspec
56
64
  - spec/filters/unique_spec.rb
57
- - spec/spec_helper.rb
58
65
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
59
66
  licenses:
60
- - Apache License (2.0)
67
+ - Apache-2.0
61
68
  metadata:
62
69
  logstash_plugin: 'true'
63
70
  logstash_group: filter
@@ -77,10 +84,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
84
  version: '0'
78
85
  requirements: []
79
86
  rubyforge_project:
80
- rubygems_version: 2.4.8
87
+ rubygems_version: 2.6.13
81
88
  signing_key:
82
89
  specification_version: 4
83
90
  summary: This filter gets the list of unique elements out of an array
84
91
  test_files:
85
92
  - spec/filters/unique_spec.rb
86
- - spec/spec_helper.rb
@@ -1,2 +0,0 @@
1
- # logstash-filter-example
2
- Example filter plugin. This should help bootstrap your effort to write your own filter plugin!
@@ -1 +0,0 @@
1
- require "logstash/devutils/rspec/spec_helper"