logstash-filter-ruby 3.1.7 → 3.1.8

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: 26f3d96124d72bdd663e9f2c384827d3b56734f296d1abfa143d68c67d67a252
4
- data.tar.gz: 2e9fc5e99df96271fb68f08396670af1e7ba03a053f5590f77f7e5634bf6227c
3
+ metadata.gz: 6f33c650c3c536720f848a957acc9aaee1015385d4c3cc8eb3ae9f5fc59e7842
4
+ data.tar.gz: 375254e8581ed78bd65355e93d7368ca76fe5e0747655c07e05ef723d04ece0a
5
5
  SHA512:
6
- metadata.gz: 168dfd8d904469861cf22aad44dfdb5accdb1a3b3b20e7dc238c02e15340fc667108a57935666a66d94fd0ca4b47fb535bdde4b38bc2011543ba6df47d93c5f5
7
- data.tar.gz: 5198f9de1bff1f32e64b09877370d01fc77a2f462dc3fe803c212f73f264763db127e21fcc7d7eead8a1deb17353244fb9f4b2634893448fa5ee48d98f146488
6
+ metadata.gz: 96b0535eef97e34451c4f0e8c3ee328b6276b541dfaa8bb36e21e5960c7615fcdac40dcacb75c8fd601022e7b783ebce4f87155a5741c3a37a44c7c362eb71e4
7
+ data.tar.gz: d4a50930afb1859269c9c36c6ccb6022bbdb0f813386373da092f1ec8541d952aec262977183a4a210e4ac3e91da007189e2a4188693a24a11fd57a3ab8ab3f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.1.8
2
+ - [DOC] Added doc to describe the option `tag_with_exception_message`[#62](https://github.com/logstash-plugins/logstash-filter-ruby/pull/62)
3
+ - Fix SyntaxError handling so other pipelines can shut down gracefully [#64](https://github.com/logstash-plugins/logstash-filter-ruby/pull/64)
4
+
1
5
  ## 3.1.7
2
6
  - [DOC] Added docs to help people avoid concurrency issues (often caused by accidentally relying on shared state with global variables, constants, or unguarded overwriting of instance variables) [#58](https://github.com/logstash-plugins/logstash-filter-ruby/issues/58)
3
7
 
data/docs/index.asciidoc CHANGED
@@ -170,6 +170,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
170
170
  | <<plugins-{type}s-{plugin}-path>> |<<string,string>>|No
171
171
  | <<plugins-{type}s-{plugin}-script_params>> |<<hash,hash>>,{}|No
172
172
  | <<plugins-{type}s-{plugin}-tag_on_exception>> |<<string,string>>,_rubyexception|No
173
+ | <<plugins-{type}s-{plugin}-tag_with_exception_message>> |<<boolean,boolean>>,_false|No
173
174
  |=======================================================================
174
175
 
175
176
  Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
@@ -222,5 +223,15 @@ of your ruby script file defined in `path`.
222
223
  Tag to add to events in case the ruby code (either inline or file based)
223
224
  causes an exception.
224
225
 
226
+ [id="plugins-{type}s-{plugin}-tag_with_exception_message"]
227
+ ===== `tag_with_exception_message`
228
+
229
+ * Value type is <<boolean,boolean>>
230
+ * Default value is `false`
231
+
232
+ If `true` adds a tag to the event that is the concatenation of `tag_with_exception_message`
233
+ and the exception message.
234
+
235
+
225
236
  [id="plugins-{type}s-{plugin}-common-options"]
226
237
  include::{include_path}/{type}.asciidoc[]
@@ -66,6 +66,9 @@ class LogStash::Filters::Ruby < LogStash::Filters::Base
66
66
  else
67
67
  @logger.fatal("You must either use an inline script with the \"code\" option or a script file using \"path\".")
68
68
  end
69
+ rescue ::ScriptError => e # SyntaxError, LoadError etc.
70
+ @logger.error("error in register", message: e.message, exception: e.class, backtrace: e.backtrace)
71
+ fail("unexpected error: #{e}")
69
72
  end
70
73
 
71
74
  def self.check_result_events!(results)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-ruby'
4
- s.version = '3.1.7'
4
+ s.version = '3.1.8'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Executes arbitrary Ruby code"
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"
@@ -29,7 +29,7 @@ describe LogStash::Filters::Ruby do
29
29
  # pretty json contains \n
30
30
  insist { subject.get("pretty").count("\n") } == 5
31
31
  # usage of JSON.parse here is to avoid parser-specific order assertions
32
- insist { JSON.parse(subject.get("pretty")) } == JSON.parse("{\n \"message\": \"hello world\",\n \"mydate\": \"2014-09-23T00:00:00-0800\",\n \"@version\": \"1\",\n \"@timestamp\": \"2014-09-23T08:00:00.000Z\"\n}")
32
+ insist { JSON.parse(subject.get("pretty")) } == JSON.parse("{\n \"message\": \"hello world\",\n \"mydate\": \"2014-09-23T00:00:00-0800\",\n \"@version\": \"1\",\n \"@timestamp\": \"#{get_logstash_timestamp("2014-09-23T08:00:00.000Z")}\"\n}")
33
33
  end
34
34
  end
35
35
 
@@ -56,7 +56,7 @@ describe LogStash::Filters::Ruby do
56
56
  # non-pretty json does not contain \n
57
57
  insist { subject.get("pretty").count("\n") } == 0
58
58
  # usage of JSON.parse here is to avoid parser-specific order assertions
59
- insist { JSON.parse(subject.get("pretty")) } == JSON.parse("{\"message\":\"hello world\",\"mydate\":\"2014-09-23T00:00:00-0800\",\"@version\":\"1\",\"@timestamp\":\"2014-09-23T08:00:00.000Z\"}")
59
+ insist { JSON.parse(subject.get("pretty")) } == JSON.parse("{\"message\":\"hello world\",\"mydate\":\"2014-09-23T00:00:00-0800\",\"@version\":\"1\",\"@timestamp\":\"#{get_logstash_timestamp("2014-09-23T08:00:00.000Z")}\"}")
60
60
  end
61
61
  end
62
62
 
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,13 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/devutils/rspec/spec_helper"
3
3
  require "insist"
4
+
5
+ module TestHelper
6
+ def get_logstash_timestamp(expected)
7
+ LogStash::Timestamp.new(expected).to_s
8
+ end
9
+ end
10
+
11
+ RSpec.configure do |config|
12
+ config.include TestHelper
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.7
4
+ version: 3.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-04 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.13
123
+ rubygems_version: 3.1.6
125
124
  signing_key:
126
125
  specification_version: 4
127
126
  summary: Executes arbitrary Ruby code