logstash-filter-drop 0.1.5 → 1.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
2
  SHA1:
3
- metadata.gz: 401fac6834ff79f8f87a37b5316034f801f3a422
4
- data.tar.gz: d8ec65475cfdcf2ab101d59da1b19d8608387959
3
+ metadata.gz: fbd9749d6b9f4e1393b8168aa4b69bb302933269
4
+ data.tar.gz: d979511eb478db6e28e26d54d9f490a0a62a0334
5
5
  SHA512:
6
- metadata.gz: 4e787901077ad48c99746d5daed383363dcf69d52c4cd1442605b5173fd6dadd07f043b306f9af3c7e064a7d78b3211ed2412df2bfc2d3f354d6cbab8efe4316
7
- data.tar.gz: a9e9f34b01ad7ad0fd3c7850763f250579833fc39c20de63faf1967d0159e5018abe1c69d8aa0cec09e3300544a7b30fb4f6dd8ee218bb7b763bce1fd0677018
6
+ metadata.gz: 053665441a628c79c78249542dd48cf9e435b5f951bcc20b8ef84c8e46d9fe647b879a7b14ede9f96f40a626c55136657f4bd9ca2803223b5c7ad939f23bafc5
7
+ data.tar.gz: 081254b79cd4c9a9d67eef0a4974a75e52e20e0006157015c1262918c9e7251896d3a3e9d29686b3399283d2530a4049262d811b7979f8ca7a20afa74f87a41d
data/CHANGELOG.md ADDED
File without changes
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md CHANGED
@@ -13,7 +13,7 @@ Logstash provides infrastructure to automatically generate documentation for thi
13
13
 
14
14
  ## Need Help?
15
15
 
16
- Need help? Try #logstash on freenode IRC or the logstash-users@googlegroups.com mailing list.
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
17
 
18
18
  ## Developing
19
19
 
@@ -9,8 +9,8 @@ require "logstash/namespace"
9
9
  # This is best used in combination with conditionals, for example:
10
10
  # [source,ruby]
11
11
  # filter {
12
- # if [loglevel] == "debug" {
13
- # drop { }
12
+ # if [loglevel] == "debug" {
13
+ # drop { }
14
14
  # }
15
15
  # }
16
16
  #
@@ -18,7 +18,20 @@ require "logstash/namespace"
18
18
  # `debug`. This will cause all events matching to be dropped.
19
19
  class LogStash::Filters::Drop < LogStash::Filters::Base
20
20
  config_name "drop"
21
-
21
+ # Drop all the events within a pre-configured percentage.
22
+ #
23
+ # This is useful if you just need a percentage but not the whole.
24
+ #
25
+ # Example, to only drop around 40% of the events that have the field loglevel wiht value "debug".
26
+ #
27
+ # filter {
28
+ # if [loglevel] == "debug" {
29
+ # drop {
30
+ # percentage => 40
31
+ # }
32
+ # }
33
+ # }
34
+ config :percentage, :validate => :number, :default => 100
22
35
  public
23
36
  def register
24
37
  # nothing to do.
@@ -26,6 +39,6 @@ class LogStash::Filters::Drop < LogStash::Filters::Base
26
39
 
27
40
  public
28
41
  def filter(event)
29
- event.cancel
42
+ event.cancel if (@percentage == 100 || rand < (@percentage / 100.0))
30
43
  end # def filter
31
44
  end # class LogStash::Filters::Drop
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-drop'
4
- s.version = '0.1.5'
4
+ s.version = '1.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Drops everything that gets to this filter."
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -15,4 +15,16 @@ describe LogStash::Filters::Drop do
15
15
  end
16
16
  end
17
17
 
18
+ describe "drop the event" do
19
+ config <<-CONFIG
20
+ filter {
21
+ drop { percentage => 0 }
22
+ }
23
+ CONFIG
24
+
25
+ sample "hello" do
26
+ reject { subject }.nil?
27
+ end
28
+ end
29
+
18
30
  end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-drop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 1.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: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- requirement: !ruby/object:Gem::Requirement
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - '>='
17
18
  - !ruby/object:Gem::Version
@@ -19,10 +20,7 @@ dependencies:
19
20
  - - <
20
21
  - !ruby/object:Gem::Version
21
22
  version: 2.0.0
22
- name: logstash-core
23
- prerelease: false
24
- type: :runtime
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - '>='
28
26
  - !ruby/object:Gem::Version
@@ -30,20 +28,22 @@ dependencies:
30
28
  - - <
31
29
  - !ruby/object:Gem::Version
32
30
  version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
- requirement: !ruby/object:Gem::Requirement
34
+ name: logstash-devutils
35
+ version_requirements: !ruby/object:Gem::Requirement
35
36
  requirements:
36
37
  - - '>='
37
38
  - !ruby/object:Gem::Version
38
39
  version: '0'
39
- name: logstash-devutils
40
- prerelease: false
41
- type: :development
42
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: !ruby/object:Gem::Requirement
43
41
  requirements:
44
42
  - - '>='
45
43
  - !ruby/object:Gem::Version
46
44
  version: '0'
45
+ prerelease: false
46
+ type: :development
47
47
  description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
48
48
  email: info@elastic.co
49
49
  executables: []
@@ -51,9 +51,11 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
+ - CHANGELOG.md
54
55
  - CONTRIBUTORS
55
56
  - Gemfile
56
57
  - LICENSE
58
+ - NOTICE.TXT
57
59
  - README.md
58
60
  - Rakefile
59
61
  - lib/logstash/filters/drop.rb
@@ -81,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
83
  version: '0'
82
84
  requirements: []
83
85
  rubyforge_project:
84
- rubygems_version: 2.1.9
86
+ rubygems_version: 2.2.2
85
87
  signing_key:
86
88
  specification_version: 4
87
89
  summary: Drops everything that gets to this filter.