logstash-filter-de_dot 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98352a8a3f114890d7b9dc1cd76dbc529db11911c9c227b7f184d1b6a32ba0b4
4
- data.tar.gz: 6afa026b74f730c0c5e8f14ff055ef6605343818420ef4cf612064d31f82be38
3
+ metadata.gz: e61d500f4e4c6529f93e1637c5f8d882e687426b8b41045c35df11495fd13a86
4
+ data.tar.gz: 912cd01e0908f96a387862001411d365e78b052528cdb720df472434e931f150
5
5
  SHA512:
6
- metadata.gz: 754076d22371d5d766e8324f4acfd08ebb9e60704086cddc60d9cc0010b2d0dc8d0489f86c23c6da6a53e58b7f0d0414b29703364b8c62568e94130a2366541d
7
- data.tar.gz: b11ef0eddcb8f76dc3ffac24eaf92ab4f591e2eb23ceaf1b181ce0006b1ffd81568734afe95efab18871e120c271ca8c6ce617d318596d68f2143b8f11e3011a
6
+ metadata.gz: 8596d82db2eacefe60272da399c688e95c8741fcb5ed22952a2ea33fb1a4c3bf862ccc3c977428c4c2f190e08b51662efb69e43f5a489ad6c396450a91a13c0c
7
+ data.tar.gz: 103d4b998e51b00bb1972861549447d677ede174165334eedcf4ada54c4ed625a0a1dcf6a1bf2c0591a989a9f5dc9304b3b85f12cc670a1a94a3bcf7a3aa6e1b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.0
2
+ - Add support to tag on failures when de_dot filter encounter a problem during the processing of the event [#26](https://github.com/logstash-plugins/logstash-filter-de_dot/pull/26)
3
+
1
4
  ## 1.1.0
2
5
  - Add support for recursively searching sub-fields with the new `recusive =>` config option [#24](https://github.com/logstash-plugins/logstash-filter-de_dot/pull/24)
3
6
 
data/docs/index.asciidoc CHANGED
@@ -39,6 +39,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
39
39
  | <<plugins-{type}s-{plugin}-nested>> |<<boolean,boolean>>|No
40
40
  | <<plugins-{type}s-{plugin}-recursive>> |<<boolean,boolean>>|No
41
41
  | <<plugins-{type}s-{plugin}-separator>> |<<string,string>>|No
42
+ | <<plugins-{type}s-{plugin}-tag_on_failure>> |<<string,string>>|No
42
43
  |=======================================================================
43
44
 
44
45
  Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
@@ -85,6 +86,14 @@ only use this when setting specific fields, as this is an expensive operation.
85
86
 
86
87
  Replace dots with this value.
87
88
 
89
+ [id="plugins-{type}s-{plugin}-tag_on_failure"]
90
+ ===== `tag_on_failure`
91
+
92
+ * Value type is <<string,string>>
93
+ * The default value for this setting is `_de_dot_error`
94
+
95
+ If a failure occurs during the application of this de_dot filter, the provided tag is added to the event.
96
+
88
97
 
89
98
 
90
99
  [id="plugins-{type}s-{plugin}-common-options"]
@@ -34,6 +34,9 @@ class LogStash::Filters::De_dot < LogStash::Filters::Base
34
34
  #
35
35
  config :fields, :validate => :array
36
36
 
37
+ # Tag to apply if the operation errors
38
+ config :tag_on_failure, :validate => :string, :default => '_de_dot_error'
39
+
37
40
  public
38
41
  def has_dot?(fieldref)
39
42
  fieldref =~ /\./
@@ -113,5 +116,10 @@ class LogStash::Filters::De_dot < LogStash::Filters::Base
113
116
  end
114
117
  end
115
118
  filter_matched(event)
119
+ rescue => ex
120
+ meta = { :exception => ex.message }
121
+ meta[:backtrace] = ex.backtrace if logger.debug?
122
+ logger.warn('Exception caught while applying de_dot filter', meta)
123
+ event.tag(@tag_on_failure)
116
124
  end # def filter
117
125
  end # class LogStash::Filters::De_dot
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-de_dot'
3
- s.version = '1.1.0'
3
+ s.version = '1.2.0'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Computationally expensive filter that removes dots from a field name"
6
6
  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"
@@ -88,6 +88,35 @@ describe LogStash::Filters::De_dot do
88
88
  expect(event.to_hash.keys).to include('nodot')
89
89
  expect(event.get('nodot')).to eq('nochange')
90
90
  end
91
+
92
+ context "when nested fields overlaps scalar fields" do
93
+ let(:config) { { "nested" => true } }
94
+ let(:attrs) { { "request" => "GET", "request.path" => "/users" } }
95
+
96
+ shared_examples('catch and tag error') do
97
+ let(:expected_tag) { '_de_dot_error' }
98
+
99
+ context 'when the event is filtered' do
100
+ before(:each) { subject.filter(event) }
101
+
102
+ it 'tags the event with the expected tag' do
103
+ expect(event).to include('tags')
104
+ expect(event.get('tags')).to include(expected_tag)
105
+ end
106
+ end
107
+ end
108
+
109
+ context "when `tag_on_failure` is not provided" do
110
+ include_examples "catch and tag error"
111
+ end
112
+
113
+ context "when `tag_on_failure` is provided" do
114
+ include_examples "catch and tag error" do
115
+ let(:expected_tag) { "_my_custom_error" }
116
+ let(:config) { super().merge("tag_on_failure" => expected_tag) }
117
+ end
118
+ end
119
+ end
91
120
  end
92
121
 
93
122
  describe "Specific nested field" do
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-de_dot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-27 00:00:00.000000000 Z
10
+ date: 2026-04-28 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
13
+ name: logstash-core-plugin-api
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -19,9 +19,8 @@ dependencies:
19
19
  - - "<="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.99'
22
- name: logstash-core-plugin-api
23
- prerelease: false
24
22
  type: :runtime
23
+ prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ">="
@@ -31,14 +30,14 @@ dependencies:
31
30
  - !ruby/object:Gem::Version
32
31
  version: '2.99'
33
32
  - !ruby/object:Gem::Dependency
33
+ name: logstash-devutils
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
36
  - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
- name: logstash-devutils
40
- prerelease: false
41
39
  type: :development
40
+ prerelease: false
42
41
  version_requirements: !ruby/object:Gem::Requirement
43
42
  requirements:
44
43
  - - ">="
@@ -70,7 +69,6 @@ licenses:
70
69
  metadata:
71
70
  logstash_plugin: 'true'
72
71
  logstash_group: filter
73
- post_install_message:
74
72
  rdoc_options: []
75
73
  require_paths:
76
74
  - lib
@@ -85,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
83
  - !ruby/object:Gem::Version
86
84
  version: '0'
87
85
  requirements: []
88
- rubygems_version: 3.2.33
89
- signing_key:
86
+ rubygems_version: 3.6.3
90
87
  specification_version: 4
91
88
  summary: Computationally expensive filter that removes dots from a field name
92
89
  test_files: