logstash-filter-fingerprint 3.0.2 → 3.0.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: 68305ab23e7ade962dc59f91089afb608fe5b686
4
- data.tar.gz: 7a8549e0f212d6c14a2a44d335a558abeb03c47c
3
+ metadata.gz: b3889ab595d8eca1bc3da12afedeccf70c57370d
4
+ data.tar.gz: e6b9ac28e026a168dc2b59ca51cd9df3af7369b6
5
5
  SHA512:
6
- metadata.gz: d8ef30f82e078b8682cb2a601e2875b74307293eb699301cf7205a3f02f2acf262a099902c218513c67e7662c6dfae46556604a5b40d3c0d0c4bc36074ea0958
7
- data.tar.gz: 32de85113911a91161e6cd5cbe72a1ae026b876a0f199601962eb82726e4806d745354956c896855c665df3d0a37fa79c1f857cd7981a8e92bdef7fbd9612cf6
6
+ metadata.gz: 8ca3a82727adf9af513c611fe06151e22c251043a222bde4bb699e889186bf04631b27780ba75ad83daa9682a615a5d9fed40b543e35e0e82a4481e5c5d8edc1
7
+ data.tar.gz: 0a8f6d898e1d2109e968284c7c26c5feadc6bf66d8d61b64d6a25634ae1cd78af01002da0c4001f0edd83bdaec334983490f30edbabe2ea35eafa1f647532d6f
data/CHANGELOG.md CHANGED
@@ -1,19 +1,26 @@
1
+ ## 3.0.3
2
+ - improve documentation and register exception messaging
3
+
1
4
  ## 3.0.2
2
5
  - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
3
6
 
4
7
  ## 3.0.1
5
- - Republish all the gems under jruby.
8
+ - internal: Republish all the gems under jruby.
9
+
6
10
  ## 3.0.0
7
- - 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
8
- # 2.0.5
9
- - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
10
- # 2.0.4
11
- - New dependency requirements for logstash-core for the 5.0 release
11
+ - internal,deps: 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
12
+
13
+ ## 2.0.5
14
+ - internal,deps: Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
15
+
16
+ ## 2.0.4
17
+ - internal,deps: New dependency requirements for logstash-core for the 5.0 release
18
+
12
19
  ## 2.0.3
13
- - Eager loading of libraries, optimizations and cleanups https://github.com/logstash-plugins/logstash-filter-fingerprint/pull/10
20
+ - internal,cleanup: Eager loading of libraries, optimizations and cleanups https://github.com/logstash-plugins/logstash-filter-fingerprint/pull/10
14
21
 
15
22
  ## 2.0.0
16
- - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
23
+ - internal: Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
17
24
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
18
- - Dependency on logstash-core update to 2.0
25
+ - internal,deps: Dependency on logstash-core update to 2.0
19
26
 
@@ -7,30 +7,67 @@ require "ipaddr"
7
7
  require "murmurhash3"
8
8
  require "securerandom"
9
9
 
10
- # Fingerprint fields using by replacing values with a consistent hash.
10
+ # Create consistent hashes (fingerprints) of one or more fields and store
11
+ # the result in a new field.
12
+ #
13
+ # This can e.g. be used to create consistent document ids when inserting
14
+ # events into Elasticsearch, allowing events in Logstash to cause existing
15
+ # documents to be updated rather than new documents to be created.
16
+ #
17
+ # NOTE: When using any method other than 'UUID', 'PUNCTUATION' or 'MURMUR3'
18
+ # you must set the key, otherwise the plugin will raise an exception
19
+ #
20
+ # NOTE: When the `target` option is set to `UUID` the result won't be
21
+ # a consistent hash but a random
22
+ # https://en.wikipedia.org/wiki/Universally_unique_identifier[UUID].
23
+ # To generate UUIDs, prefer the <<plugins-filters-uuid,uuid filter>>.
11
24
  class LogStash::Filters::Fingerprint < LogStash::Filters::Base
12
25
  config_name "fingerprint"
13
26
 
14
- # Source field(s)
27
+ # The name(s) of the source field(s) whose contents will be used
28
+ # to create the fingerprint. If an array is given, see the
29
+ # `concatenate_sources` option.
15
30
  config :source, :validate => :array, :default => 'message'
16
31
 
17
- # Target field.
18
- # will overwrite current value of a field if it exists.
32
+ # The name of the field where the generated fingerprint will be stored.
33
+ # Any current contents of that field will be overwritten.
19
34
  config :target, :validate => :string, :default => 'fingerprint'
20
35
 
21
- # When used with `IPV4_NETWORK` method fill in the subnet prefix length
22
- # Not required for `MURMUR3` or `UUID` methods
23
- # With other methods fill in the `HMAC` key
36
+ # When used with the `IPV4_NETWORK` method fill in the subnet prefix length.
37
+ # Not required for `MURMUR3`, `PUNCTUATION` or `UUID` methods.
38
+ # With other methods fill in the HMAC key.
24
39
  config :key, :validate => :string
25
40
 
26
- # When set to 'true', SHA1', 'SHA256', 'SHA384', 'SHA512' and 'MD5' fingerprint methods will be returned
27
- # base64 encoded rather than hex encoded.
41
+ # When set to `true`, the `SHA1`, `SHA256`, `SHA384`, `SHA512` and `MD5` fingerprint methods will produce
42
+ # base64 encoded rather than hex encoded strings.
28
43
  config :base64encode, :validate => :boolean, :default => false
29
44
 
30
- # Fingerprint method
45
+ # The fingerprint method to use.
46
+ #
47
+ # If set to `SHA1`, `SHA256`, `SHA384`, `SHA512`, or `MD5` the
48
+ # cryptographic keyed-hash function with the same name will be used to
49
+ # generate the fingerprint. If set to `MURMUR3` the non-cryptographic
50
+ # MurmurHash function will be used.
51
+ #
52
+ # If set to `IPV4_NETWORK` the input data needs to be a IPv4 address and
53
+ # the hash value will be the masked-out address using the number of bits
54
+ # specified in the `key` option. For example, with "1.2.3.4" as the input
55
+ # and `key` set to 16, the hash becomes "1.2.0.0".
56
+ #
57
+ # If set to `PUNCTUATION`, all non-punctuation characters will be removed
58
+ # from the input string.
59
+ #
60
+ # If set to `UUID`, a
61
+ # https://en.wikipedia.org/wiki/Universally_unique_identifier[UUID] will
62
+ # be generated. The result will be random and thus not a consistent hash.
31
63
  config :method, :validate => ['SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', "MURMUR3", "IPV4_NETWORK", "UUID", "PUNCTUATION"], :required => true, :default => 'SHA1'
32
64
 
33
- # When set to `true`, we concatenate the values of all fields into 1 string like the old checksum filter.
65
+ # When set to `true` and `method` isn't `UUID` or `PUNCTUATION`, the
66
+ # plugin concatenates the names and values of all fields given in the
67
+ # `source` option into one string (like the old checksum filter) before
68
+ # doing the fingerprint computation. If `false` and multiple source
69
+ # fields are given, the target field will be an array with fingerprints
70
+ # of the source fields given.
34
71
  config :concatenate_sources, :validate => :boolean, :default => false
35
72
 
36
73
  def register
@@ -42,7 +79,7 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
42
79
  when :IPV4_NETWORK
43
80
  if @key.nil?
44
81
  raise LogStash::ConfigurationError, I18n.t(
45
- "logstash.agent.configuration.invalid_plugin_register",
82
+ "logstash.runner.configuration.invalid_plugin_register",
46
83
  :plugin => "filter",
47
84
  :type => "fingerprint",
48
85
  :error => "Key value is empty. please fill in a subnet prefix length"
@@ -58,7 +95,7 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
58
95
  else
59
96
  if @key.nil?
60
97
  raise LogStash::ConfigurationError, I18n.t(
61
- "logstash.agent.configuration.invalid_plugin_register",
98
+ "logstash.runner.configuration.invalid_plugin_register",
62
99
  :plugin => "filter",
63
100
  :type => "fingerprint",
64
101
  :error => "Key value is empty. Please fill in an encryption key"
@@ -101,6 +138,7 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
101
138
  end
102
139
  end
103
140
  end
141
+ filter_matched(event)
104
142
  end
105
143
 
106
144
  private
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-fingerprint'
4
- s.version = '3.0.2'
4
+ s.version = '3.0.3'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Fingerprint fields using by replacing values with a consistent hash."
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/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -286,4 +286,22 @@ describe LogStash::Filters::Fingerprint do
286
286
  end
287
287
  end
288
288
 
289
+ describe "execution triggers addition of fields and tags" do
290
+ config <<-CONFIG
291
+ filter {
292
+ fingerprint {
293
+ source => 'field1'
294
+ method => 'PUNCTUATION'
295
+ add_field => { 'myfield' => 'myvalue' }
296
+ add_tag => ['mytag']
297
+ }
298
+ }
299
+ CONFIG
300
+
301
+ sample("field1" => "Hello, World!") do
302
+ insist { subject.get("myfield") } == "myvalue"
303
+ insist { subject.get("tags") } == ["mytag"]
304
+ end
305
+ end
306
+
289
307
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-fingerprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.6.3
98
+ rubygems_version: 2.4.8
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Fingerprint fields using by replacing values with a consistent hash.