logstash-filter-fingerprint 3.3.0 → 3.3.1

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
  SHA256:
3
- metadata.gz: 0a14dcbc1585cf2f6afea7bed7a0e056d2f098bc896dc6d7571caf3c5cc3c51d
4
- data.tar.gz: 2c7714afaaee24b9a8995d541ffa1cab5d16dc907dd3d1e98213d7b218fb0ebf
3
+ metadata.gz: 595333133cc076fc879955fa5a665387dfd4d33d4af757d56d163a6a3eeb16d8
4
+ data.tar.gz: 912e104bd727b7b3f427d24f038288ca5d08087242267d55b4fc6899403ba378
5
5
  SHA512:
6
- metadata.gz: cbaccf02918c11b39f2f1f7bc78d7a16fbbac76d7bef9edebcb907f89cba98126708c07c05497d1e1cd5862e1846bb37b5779aaa51937382d8f416264f111328
7
- data.tar.gz: 2df22689f778872a0cd85e000ff8ef940e7a16dfec4c469c4a846e7457e599e887768d3d26bd630af0af45ae0b6740cd800d3b2d89cd08bdb08f76124cad1d2b
6
+ metadata.gz: d9f4631d499c888a5681c63be1d254d45392fc00c6e281d6bb5ddcd24028d0af43e4e0c6b9f99a0a082693e5559a44fb4d2ce5a3894e2c5081d9937e94ccb15e
7
+ data.tar.gz: c280e2fc1b976d11e9e57ccb444f8153e953f9f0ff7f74b393e1b1c670d9ed4c6932d8af14a6883806f0079419292df8aae9130fb1334ff4013e193a0c989925
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.3.1
2
+ - Force encoding to UTF-8 when concatenating sources to generate fingerprint [#64](https://github.com/logstash-plugins/logstash-filter-fingerprint/pull/64)
3
+
1
4
  ## 3.3.0
2
5
  - Add ECS compatibility [#62](https://github.com/logstash-plugins/logstash-filter-fingerprint/pull/62)
3
6
 
@@ -128,11 +128,13 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
128
128
  to_string = ""
129
129
  if @concatenate_all_fields
130
130
  deep_sort_hashes(event.to_hash).each do |k,v|
131
- to_string << "|#{k}|#{v}"
131
+ # Force encoding to UTF-8 to get around https://github.com/jruby/jruby/issues/6748
132
+ to_string << "|#{k}|#{v}".force_encoding("UTF-8")
132
133
  end
133
134
  else
134
135
  @source.sort.each do |k|
135
- to_string << "|#{k}|#{deep_sort_hashes(event.get(k))}"
136
+ # Force encoding to UTF-8 to get around https://github.com/jruby/jruby/issues/6748
137
+ to_string << "|#{k}|#{deep_sort_hashes(event.get(k))}".force_encoding("UTF-8")
136
138
  end
137
139
  end
138
140
  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.3.0'
4
+ s.version = '3.3.1'
5
5
  s.licenses = ['Apache-2.0']
6
6
  s.summary = "Fingerprints fields 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"
@@ -192,6 +192,23 @@ describe LogStash::Filters::Fingerprint, :ecs_compatibility_support, :aggregate_
192
192
  end
193
193
  end
194
194
 
195
+ context "when utf-8 chars used" do
196
+ let(:config) { super().merge("source" => ['field1', 'field2']) }
197
+ let(:data) { {"field1"=>[{"inner_key"=>"🂡"}, {"1"=>"2"}], "field2"=>"🂡"} }
198
+ it "fingerprints the value of the last value" do
199
+ # SHA1 of "|field1|inner_key|🂡|1|2|field2|🂡|"
200
+ expect(fingerprint).to eq("58fa9e0e60c9f0d24b51d84cddb26732a39eeb3d")
201
+ end
202
+
203
+ describe "with concatenate_sources" do
204
+ let(:config) { super().merge("concatenate_sources" => true) }
205
+ it "fingerprints the value of concatenated key/pairs" do
206
+ # SHA1 of "|field1|inner_key|🂡|1|2|field2|🂡|"
207
+ expect(fingerprint).to eq("d74f41841c7cdc793a97c218d2ff18064a5f1950")
208
+ end
209
+ end
210
+ end
211
+
195
212
  describe "PUNCTUATION method" do
196
213
  let(:fingerprint_method) { 'PUNCTUATION' }
197
214
  let(:config) { super().merge("source" => 'field1') }
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.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement