logstash-filter-kv 2.0.3 → 2.0.4
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 +3 -0
- data/lib/logstash/filters/kv.rb +4 -2
- data/logstash-filter-kv.gemspec +1 -2
- data/spec/filters/kv_spec.rb +29 -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: 173341a071a48586f6990109102f5d6ee2ad0763
|
4
|
+
data.tar.gz: f46c88d52048613c298361ceb5e67c7a31e000a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 797bc5b31e5cff7de16d7734d1d50cd3017d7631132f2487604851573925ee72af79225face47c07202c7589a00b15dd729a360cbdc99fd68907b9ac1ed49ac1
|
7
|
+
data.tar.gz: 64198181139ce12f0d2876170172f07acc2397c139f8ef07ac990ee826be96002c349fae230c4f92f52f5f8f13acab379ac69d5a4c9b91480cc0d7ac6fdf2cb5
|
data/CHANGELOG.md
CHANGED
data/lib/logstash/filters/kv.rb
CHANGED
@@ -186,12 +186,15 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
186
186
|
# `bracketsone=(hello world) bracketstwo=[hello world]`
|
187
187
|
#
|
188
188
|
# will be:
|
189
|
+
#
|
189
190
|
# * bracketsone: hello world
|
190
191
|
# * bracketstwo: hello world
|
191
192
|
#
|
192
193
|
# instead of:
|
194
|
+
#
|
193
195
|
# * bracketsone: (hello
|
194
196
|
# * bracketstwo: [hello
|
197
|
+
#
|
195
198
|
config :include_brackets, :validate => :boolean, :default => true
|
196
199
|
|
197
200
|
# A boolean specifying whether to drill down into values
|
@@ -215,8 +218,7 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
215
218
|
valueRxString = "(?:\"([^\"]+)\"|'([^']+)'"
|
216
219
|
valueRxString += "|\\(([^\\)]+)\\)|\\[([^\\]]+)\\]" if @include_brackets
|
217
220
|
valueRxString += "|((?:\\\\ |[^" + @field_split + "])+))"
|
218
|
-
@scan_re = Regexp.new("((?:\\\\ |[^" + @field_split + @value_split + "])+)
|
219
|
-
|
221
|
+
@scan_re = Regexp.new("((?:\\\\ |[^" + @field_split + @value_split + "])+)\s*[" + @value_split + "]\s*" + valueRxString)
|
220
222
|
@value_split_re = /[#{@value_split}]/
|
221
223
|
end
|
222
224
|
|
data/logstash-filter-kv.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-kv'
|
4
|
-
s.version = '2.0.
|
4
|
+
s.version = '2.0.4'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This filter helps automatically parse messages (or specific event fields) which are of the 'foo=bar' variety."
|
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"
|
@@ -24,4 +24,3 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.add_development_dependency 'logstash-devutils'
|
26
26
|
end
|
27
|
-
|
data/spec/filters/kv_spec.rb
CHANGED
@@ -600,4 +600,33 @@ describe LogStash::Filters::KV do
|
|
600
600
|
insist { subject["[foo]"] } == ["bar", "yeah", "yeah"]
|
601
601
|
end
|
602
602
|
end
|
603
|
+
|
604
|
+
describe "keys without values (reported in #22)" do
|
605
|
+
subject do
|
606
|
+
plugin = LogStash::Filters::KV.new(options)
|
607
|
+
plugin.register
|
608
|
+
plugin
|
609
|
+
end
|
610
|
+
|
611
|
+
let(:message) { "AccountStatus: 4\r\nAdditionalInformation\r\n\r\nCode: \r\nHttpStatusCode: \r\nIsSuccess: True\r\nMessage: \r\n" }
|
612
|
+
let(:data) { {"message" => message} }
|
613
|
+
let(:event) { LogStash::Event.new(data) }
|
614
|
+
let(:options) {
|
615
|
+
{
|
616
|
+
"field_split" => "\r\n",
|
617
|
+
"value_split" => " ",
|
618
|
+
"trimkey" => ":"
|
619
|
+
}
|
620
|
+
}
|
621
|
+
|
622
|
+
context "key and splitters with no value" do
|
623
|
+
it "should ignore the incomplete key/value pairs" do
|
624
|
+
subject.filter(event)
|
625
|
+
expect(event["AccountStatus"]).to eq("4")
|
626
|
+
expect(event["IsSuccess"]).to eq("True")
|
627
|
+
expect(event.to_hash.keys.sort).to eq(
|
628
|
+
["@timestamp", "@version", "AccountStatus", "IsSuccess", "message"])
|
629
|
+
end
|
630
|
+
end
|
631
|
+
end
|
603
632
|
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: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|