logstash-filter-fingerprint 3.0.4 → 3.1.0
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/docs/index.asciidoc +15 -1
- data/lib/logstash/filters/fingerprint.rb +14 -3
- data/logstash-filter-fingerprint.gemspec +1 -1
- data/spec/filters/fingerprint_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ea4c93a45f7e5a3792b6c251a05ab75f9727fd
|
4
|
+
data.tar.gz: bd7a89aacc70afd45a166a91a6cdf8e6794d056f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1a3474f9b9a140c49ade799c53a8b061e9e5894fa6d62064586e688b0f606e7261ff017d5be0b9d02da47a7e340d727ef8a87e5a81c69b2ee5d207b857c2796
|
7
|
+
data.tar.gz: 114a5e5a0b61c864cfcbeb8588c083371821109e9e63394f40253b17eb8afd690eff1a3a6920acd6c8f718a598c57d844d4619cc9cd37e050f1f4449e3f206e5
|
data/CHANGELOG.md
CHANGED
data/docs/index.asciidoc
CHANGED
@@ -12,7 +12,7 @@ START - GENERATED VARIABLES, DO NOT EDIT!
|
|
12
12
|
END - GENERATED VARIABLES, DO NOT EDIT!
|
13
13
|
///////////////////////////////////////////
|
14
14
|
|
15
|
-
[id="plugins-{type}-{plugin}"]
|
15
|
+
[id="plugins-{type}s-{plugin}"]
|
16
16
|
|
17
17
|
=== Fingerprint filter plugin
|
18
18
|
|
@@ -45,6 +45,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
45
45
|
|Setting |Input type|Required
|
46
46
|
| <<plugins-{type}s-{plugin}-base64encode>> |<<boolean,boolean>>|No
|
47
47
|
| <<plugins-{type}s-{plugin}-concatenate_sources>> |<<boolean,boolean>>|No
|
48
|
+
| <<plugins-{type}s-{plugin}-concatenate_all_fields>> |<<boolean,boolean>>|No
|
48
49
|
| <<plugins-{type}s-{plugin}-key>> |<<string,string>>|No
|
49
50
|
| <<plugins-{type}s-{plugin}-method>> |<<string,string>>, one of `["SHA1", "SHA256", "SHA384", "SHA512", "MD5", "MURMUR3", "IPV4_NETWORK", "UUID", "PUNCTUATION"]`|Yes
|
50
51
|
| <<plugins-{type}s-{plugin}-source>> |<<array,array>>|No
|
@@ -78,6 +79,19 @@ doing the fingerprint computation. If `false` and multiple source
|
|
78
79
|
fields are given, the target field will be an array with fingerprints
|
79
80
|
of the source fields given.
|
80
81
|
|
82
|
+
[id="plugins-{type}s-{plugin}-concatenate_all_fields"]
|
83
|
+
===== `concatenate_sources`
|
84
|
+
|
85
|
+
* Value type is <<boolean,boolean>>
|
86
|
+
* Default value is `false`
|
87
|
+
|
88
|
+
When set to `true` and `method` isn't `UUID` or `PUNCTUATION`, the
|
89
|
+
plugin concatenates the names and values of all fields of the event
|
90
|
+
into one string (like the old checksum filter) before doing the
|
91
|
+
fingerprint computation. If `false` and at least one source field is
|
92
|
+
given, the target field will be an array with fingerprints of the
|
93
|
+
source fields given.
|
94
|
+
|
81
95
|
[id="plugins-{type}s-{plugin}-key"]
|
82
96
|
===== `key`
|
83
97
|
|
@@ -70,6 +70,11 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
|
|
70
70
|
# of the source fields given.
|
71
71
|
config :concatenate_sources, :validate => :boolean, :default => false
|
72
72
|
|
73
|
+
# When set to `true` and `method` isn't `UUID` or `PUNCTUATION`, the
|
74
|
+
# plugin concatenates the names and values of all fields in the event
|
75
|
+
# without having to proide the field names in the `source` attribute
|
76
|
+
config :concatenate_all_fields, :validate => :boolean, :default => false
|
77
|
+
|
73
78
|
def register
|
74
79
|
# convert to symbol for faster comparisons
|
75
80
|
@method = @method.to_sym
|
@@ -119,10 +124,16 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
|
|
119
124
|
event.set(@target, event.get(field).gsub(/[^[\p{P}\p{S}]]/,''))
|
120
125
|
end
|
121
126
|
else
|
122
|
-
if @concatenate_sources
|
127
|
+
if @concatenate_sources || @concatenate_all_fields
|
123
128
|
to_string = ""
|
124
|
-
@
|
125
|
-
|
129
|
+
if @concatenate_all_fields
|
130
|
+
event.to_hash.sort.map do |k,v|
|
131
|
+
to_string << "|#{k}|#{v}"
|
132
|
+
end
|
133
|
+
else
|
134
|
+
@source.sort.each do |k|
|
135
|
+
to_string << "|#{k}|#{event.get(k)}"
|
136
|
+
end
|
126
137
|
end
|
127
138
|
to_string << "|"
|
128
139
|
@logger.debug? && @logger.debug("String built", :to_checksum => to_string)
|
@@ -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
|
4
|
+
s.version = '3.1.0'
|
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"
|
@@ -51,6 +51,23 @@ describe LogStash::Filters::Fingerprint do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe "fingerprint string with SHA1 alogrithm on all event fields" do
|
55
|
+
config <<-CONFIG
|
56
|
+
filter {
|
57
|
+
fingerprint {
|
58
|
+
concatenate_all_fields => true
|
59
|
+
key => "longencryptionkey"
|
60
|
+
method => 'SHA1'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
CONFIG
|
64
|
+
|
65
|
+
# The @timestamp field is specified in this sample event as we need the event contents to be constant for the tests
|
66
|
+
sample("@timestamp" => "2017-07-26T14:44:27.064Z", "clientip" => "123.123.123.123", "message" => "This is a test message", "log_level" => "INFO", "offset" => 123456789, "type" => "test") do
|
67
|
+
insist { subject.get("fingerprint") } == "d7c617f4d40b2cb677a7003af68a41c415f58031"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
54
71
|
describe "fingerprint string with SHA1 alogrithm and base64 encoding" do
|
55
72
|
config <<-CONFIG
|
56
73
|
filter {
|
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
|
4
|
+
version: 3.1.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-
|
11
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|