logstash-filter-kv 4.6.0 → 4.7.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 +3 -0
- data/docs/index.asciidoc +4 -4
- data/lib/logstash/filters/kv.rb +7 -7
- data/logstash-filter-kv.gemspec +1 -1
- data/spec/filters/kv_spec.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da90e7e03c6cb4960a1c224d216f03ee985b6f1b320832b265b4abd112ac5ade
|
4
|
+
data.tar.gz: a4f50d4707f2a3c74cd917e8f86b1acc53e974b56e967953009c6b1f6d241ec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b2f78f389c0ae6d43132aff4fce9ff868dd044a220cd9aeaf69c5015d05c0a200be2c6fdc0df9876c4395912e8ff32ee2649e464a2d2d7dc70274243994f08e
|
7
|
+
data.tar.gz: 855fb4feebcb15be71505bef3ca4920b60d2e06c1adfd3ae646dc2caf5c95ac69609a6a7cc52ab327bcfce29f92cace5e47612b6a8af542016f468657a007b17
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 4.7.0
|
2
|
+
- Allow attaching multiple tags on failure. The `tag_on_failure` option now also supports an array of strings [#92](https://github.com/logstash-plugins/logstash-filter-kv/issues/92)
|
3
|
+
|
1
4
|
## 4.6.0
|
2
5
|
- Added `allow_empty_values` option [#72](https://github.com/logstash-plugins/logstash-filter-kv/pull/72)
|
3
6
|
|
data/docs/index.asciidoc
CHANGED
@@ -74,7 +74,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
74
74
|
| <<plugins-{type}s-{plugin}-remove_char_value>> |<<string,string>>|No
|
75
75
|
| <<plugins-{type}s-{plugin}-source>> |<<string,string>>|No
|
76
76
|
| <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
|
77
|
-
| <<plugins-{type}s-{plugin}-tag_on_failure>> |<<
|
77
|
+
| <<plugins-{type}s-{plugin}-tag_on_failure>> |<<array,array>>|No
|
78
78
|
| <<plugins-{type}s-{plugin}-tag_on_timeout>> |<<string,string>>|No
|
79
79
|
| <<plugins-{type}s-{plugin}-timeout_millis>> |<<number,number>>|No
|
80
80
|
| <<plugins-{type}s-{plugin}-transform_key>> |<<string,string>>, one of `["lowercase", "uppercase", "capitalize"]`|No
|
@@ -372,12 +372,12 @@ For example, to place all keys into the event field kv:
|
|
372
372
|
[id="plugins-{type}s-{plugin}-tag_on_failure"]
|
373
373
|
===== `tag_on_failure`
|
374
374
|
|
375
|
-
* Value type is <<
|
376
|
-
* The default value for this setting is `_kv_filter_error
|
375
|
+
* Value type is <<array,array>>
|
376
|
+
* The default value for this setting is [`_kv_filter_error`].
|
377
377
|
|
378
378
|
When a kv operation causes a runtime exception to be thrown within the plugin,
|
379
379
|
the operation is safely aborted without crashing the plugin, and the event is
|
380
|
-
tagged with the provided
|
380
|
+
tagged with the provided values.
|
381
381
|
|
382
382
|
[id="plugins-{type}s-{plugin}-tag_on_timeout"]
|
383
383
|
===== `tag_on_timeout`
|
data/lib/logstash/filters/kv.rb
CHANGED
@@ -67,7 +67,7 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
67
67
|
# These characters form a regex character class and thus you must escape special regex
|
68
68
|
# characters like `[` or `]` using `\`.
|
69
69
|
#
|
70
|
-
# Only leading and trailing characters are
|
70
|
+
# Only leading and trailing characters are trimmed from the key.
|
71
71
|
#
|
72
72
|
# For example, to trim `<` `>` `[` `]` and `,` characters from keys:
|
73
73
|
# [source,ruby]
|
@@ -338,7 +338,7 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
338
338
|
config :tag_on_timeout, :validate => :string, :default => '_kv_filter_timeout'
|
339
339
|
|
340
340
|
# Tag to apply if kv errors
|
341
|
-
config :tag_on_failure, :validate => :
|
341
|
+
config :tag_on_failure, :validate => :array, :default => ['_kv_filter_error']
|
342
342
|
|
343
343
|
|
344
344
|
EMPTY_STRING = ''.freeze
|
@@ -425,8 +425,8 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
425
425
|
|
426
426
|
@logger.debug? && @logger.debug("KV scan regex", :regex => @scan_re.inspect)
|
427
427
|
|
428
|
-
# divide by float to allow
|
429
|
-
# executor resolution is in microseconds so
|
428
|
+
# divide by float to allow fractional seconds, the Timeout class timeout value is in seconds but the underlying
|
429
|
+
# executor resolution is in microseconds so fractional second parameter down to microseconds is possible.
|
430
430
|
# see https://github.com/jruby/jruby/blob/9.2.7.0/core/src/main/java/org/jruby/ext/timeout/Timeout.java#L125
|
431
431
|
@timeout_seconds = @timeout_millis / 1000.0
|
432
432
|
end
|
@@ -460,7 +460,7 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
460
460
|
meta = { :exception => ex.message }
|
461
461
|
meta[:backtrace] = ex.backtrace if logger.debug?
|
462
462
|
logger.warn('Exception while parsing KV', meta)
|
463
|
-
event.tag(
|
463
|
+
@tag_on_failure.each { |tag| event.tag(tag) }
|
464
464
|
end
|
465
465
|
|
466
466
|
def close
|
@@ -500,9 +500,9 @@ class LogStash::Filters::KV < LogStash::Filters::Base
|
|
500
500
|
|
501
501
|
value = value.to_s
|
502
502
|
|
503
|
-
value.bytesize < 255 ? "`#{value}`" : "entry too large; first 255
|
503
|
+
value.bytesize < 255 ? "`#{value.dump}`" : "(entry too large to show; showing first 255 characters) `#{value[0..255].dump}`[...]"
|
504
504
|
end
|
505
|
-
|
505
|
+
|
506
506
|
def has_value_splitter?(s)
|
507
507
|
s =~ @value_split_re
|
508
508
|
end
|
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 = '4.
|
4
|
+
s.version = '4.7.0'
|
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"
|
data/spec/filters/kv_spec.rb
CHANGED
@@ -460,7 +460,6 @@ describe LogStash::Filters::KV do
|
|
460
460
|
end
|
461
461
|
end
|
462
462
|
|
463
|
-
|
464
463
|
describe "test data from specific sub source" do
|
465
464
|
config <<-CONFIG
|
466
465
|
filter {
|
@@ -519,7 +518,6 @@ describe LogStash::Filters::KV do
|
|
519
518
|
end
|
520
519
|
end
|
521
520
|
|
522
|
-
|
523
521
|
describe "test data from specific sub source and target" do
|
524
522
|
config <<-CONFIG
|
525
523
|
filter {
|
@@ -1059,7 +1057,6 @@ describe "multi character splitting" do
|
|
1059
1057
|
it_behaves_like "parsing all fields and values"
|
1060
1058
|
end
|
1061
1059
|
|
1062
|
-
|
1063
1060
|
context "example from @guyboertje in #15" do
|
1064
1061
|
let(:message) { 'key1: val1; key2: val2; key3: https://site/?g={......"...; CLR rv:11.0)"..}; key4: val4;' }
|
1065
1062
|
let(:options) {
|
@@ -1152,6 +1149,17 @@ context 'runtime errors' do
|
|
1152
1149
|
plugin.filter(event)
|
1153
1150
|
expect(event.get('tags')).to_not be_nil
|
1154
1151
|
expect(event.get('tags')).to include('KV-ERROR')
|
1152
|
+
expect(event.get('tags')).to_not include('_kv_filter_error')
|
1153
|
+
end
|
1154
|
+
end
|
1155
|
+
context 'when multiple custom tags are defined' do
|
1156
|
+
let(:options) { super().merge("tag_on_failure" => ["kv_FAIL_one", "_kv_fail_TWO"])}
|
1157
|
+
it 'tags the event with the custom tag' do
|
1158
|
+
plugin.filter(event)
|
1159
|
+
expect(event.get('tags')).to_not be_nil
|
1160
|
+
expect(event.get('tags')).to include('kv_FAIL_one')
|
1161
|
+
expect(event.get('tags')).to include('_kv_fail_TWO')
|
1162
|
+
expect(event.get('tags')).to_not include('_kv_filter_error')
|
1155
1163
|
end
|
1156
1164
|
end
|
1157
1165
|
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.
|
4
|
+
version: 4.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|