logstash-filter-kv 4.1.0 → 4.1.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: db1a1524254aafe6af64400a781c90fe02a0e82bcc037d8ce43b652de30dea93
4
- data.tar.gz: 36443b889dfde58914512466fe3eadb703fca7c30b665a3d02106f5c6b91cada
3
+ metadata.gz: 5c2b2e468b13494eda3ab5a4252ec1bc3b1ac73516c7de0f767d5f3a21d1c467
4
+ data.tar.gz: 145252f085544e2edbceef88a6bef4cc720f6ce745e022150c25657588c3f6d8
5
5
  SHA512:
6
- metadata.gz: 072403211a806a928e240df180ab2180257b22579db3dd9de9d3ec4065f0e9b75374db3ade99c7e09ad0fc5b66f09701026ee97f81ec3a76c98826b50bd33e94
7
- data.tar.gz: 8c7dd7066d669c4f0fea15942f14fc2c80a9412190e31bb0b36cb7382843b3f8839b843b89c72ba930eb04e697e7e5536b01603c78c0666db2b81a49948a0d3d
6
+ metadata.gz: 718f14bae4895dd2d9cfc252abaace7ae1f784703ec569fb9143946d21378d638889dca25db6f430bdaa25f7838eedda6c2e08eab76d520385701b7171752bcb
7
+ data.tar.gz: acee9e93136b19746cac5714cf46d5d45e0780caba1ab935aa42a1f26baaa45a111b5214b04cb7dff6499e11a2f6011053d7a46180f8c9b6d78419d80f5b2e13
@@ -1,3 +1,6 @@
1
+ ## 4.1.1
2
+ - bugfix: correctly handle empty values between value separator and field separator (#58)
3
+
1
4
  ## 4.1.0
2
5
  - feature: add option to split fields and values using a regex pattern (#55)
3
6
 
@@ -356,7 +356,7 @@ class LogStash::Filters::KV < LogStash::Filters::Base
356
356
  end
357
357
 
358
358
  # an unquoted value is a _captured_ sequence of characters or escaped spaces before a `field_split` or EOF.
359
- value_patterns << /((?:\\ |.)+?)(?=#{Regexp::union(field_split, eof)})/
359
+ value_patterns << /((?:\\ |.)*?)(?=#{Regexp::union(field_split, eof)})/
360
360
 
361
361
  Regexp.union(*value_patterns)
362
362
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-kv'
4
- s.version = '4.1.0'
4
+ s.version = '4.1.1'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Parses key-value pairs"
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"
@@ -897,4 +897,37 @@ describe "multi character splitting" do
897
897
  end
898
898
  end
899
899
 
900
+ describe "handles empty values" do
901
+ let(:message) { 'a=1|b=|c=3' }
902
+
903
+ shared_examples "parse empty values" do
904
+ it "splits correctly upon empty value" do
905
+ subject.filter(event)
906
+
907
+ expect(event.get("a")).to eq("1")
908
+ expect(event.get("b")).to be_nil
909
+ expect(event.get("c")).to eq("3")
910
+ end
911
+ end
912
+
913
+ context "using char class splitters" do
914
+ let(:options) {
915
+ {
916
+ "field_split" => "|",
917
+ "value_split" => "=",
918
+ }
919
+ }
920
+ it_behaves_like "parse empty values"
921
+ end
922
+
923
+ context "using pattern splitters" do
924
+ let(:options) {
925
+ {
926
+ "field_split_pattern" => '\|',
927
+ "value_split_pattern" => "=",
928
+ }
929
+ }
930
+ it_behaves_like "parse empty values"
931
+ end
932
+ end
900
933
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-kv
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-13 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement