logstash-filter-ruby 2.0.2 → 2.0.3

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
  SHA1:
3
- metadata.gz: 37053bb464b80461213c0a54776667f58fac9b8d
4
- data.tar.gz: dd792872a96962ae9e7a0baeba3ef40a25a01255
3
+ metadata.gz: ec10427dca014198834f2b11320b35263c3a1122
4
+ data.tar.gz: 7c8c9575babd81c28c6b24c03c2bac9d5a9d2271
5
5
  SHA512:
6
- metadata.gz: 5f99c80daab16d9efc7a0afc55471232d88a7ed6da3504596382d751074a9283ce5d2703364869d8908bfe6733d2d31506462b6d03900c96b9e30e643887cb3e
7
- data.tar.gz: 5c150ef1b9b4782233bc88ca65c618d266cd0860fe5d2272e9b78460f6dae743c5b7b82303b944ad5d15804f7644f64b6d21cfd9a14991a3f4daea448a52fa42
6
+ metadata.gz: a220311c4039c9e02ef52a1284c3060e8f90bae838ac2c59bf7b30491341b723bcc3b3fb4ddb1f1b60c56b8e0f4b368daea0b6da50ff44d22b4744c4b59f63f4
7
+ data.tar.gz: 1fc435118eb13a6edfeb1f068b443a60e54fbe0e27a6d0c05c61f918bbfbda0ae1e6be65488a2fa7d7a484cac39168f48093b96db4e766b800e46683d2a40a6a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
+ ## 2.0.3
2
+ - Code cleanup and fixed json order verification is specs
3
+
1
4
  ## 2.0.0
2
- - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
5
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
3
6
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
4
7
  - Dependency on logstash-core update to 2.0
5
8
 
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Logstash Plugin
2
2
 
3
+ [![Build
4
+ Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Filters/job/logstash-plugin-filter-ruby-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Filters/job/logstash-plugin-filter-ruby-unit/)
5
+
3
6
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
7
 
5
8
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
@@ -10,8 +10,8 @@ require "logstash/namespace"
10
10
  # ruby {
11
11
  # # Cancel 90% of events
12
12
  # code => "event.cancel if rand <= 0.90"
13
- # }
14
- # }
13
+ # }
14
+ # }
15
15
  #
16
16
  class LogStash::Filters::Ruby < LogStash::Filters::Base
17
17
  config_name "ruby"
@@ -23,17 +23,13 @@ class LogStash::Filters::Ruby < LogStash::Filters::Base
23
23
  # You will have an `event` variable available that is the event itself.
24
24
  config :code, :validate => :string, :required => true
25
25
 
26
- public
27
26
  def register
28
27
  # TODO(sissel): Compile the ruby code
29
28
  eval(@init, binding, "(ruby filter init)") if @init
30
29
  eval("@codeblock = lambda { |event| #{@code} }", binding, "(ruby filter code)")
31
- end # def register
30
+ end
32
31
 
33
- public
34
32
  def filter(event)
35
-
36
-
37
33
  begin
38
34
  @codeblock.call(event)
39
35
  filter_matched(event)
@@ -41,5 +37,5 @@ class LogStash::Filters::Ruby < LogStash::Filters::Base
41
37
  @logger.error("Ruby exception occurred: #{e}")
42
38
  event.tag("_rubyexception")
43
39
  end
44
- end # def filter
45
- end # class LogStash::Filters::Ruby
40
+ end
41
+ end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-ruby'
4
- s.version = '2.0.2'
4
+ s.version = '2.0.3'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Filter for executing ruby code on the event"
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"
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require "logstash/devutils/rspec/spec_helper"
2
4
  require "logstash/filters/ruby"
3
5
  require "logstash/filters/date"
@@ -25,7 +27,10 @@ describe LogStash::Filters::Ruby do
25
27
 
26
28
  sample("message" => "hello world", "mydate" => "2014-09-23T00:00:00-0800") do
27
29
  # json is rendered in pretty json since the JSON.pretty_generate created json from the event hash
28
- insist { subject["pretty"] } == "{\n \"message\": \"hello world\",\n \"mydate\": \"2014-09-23T00:00:00-0800\",\n \"@version\": \"1\",\n \"@timestamp\": \"2014-09-23T08:00:00.000Z\"\n}"
30
+ # pretty json contains \n
31
+ insist { subject["pretty"].count("\n") } == 5
32
+ # usage of JSON.parse here is to avoid parser-specific order assertions
33
+ insist { JSON.parse(subject["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}")
29
34
  end
30
35
  end
31
36
 
@@ -49,7 +54,10 @@ describe LogStash::Filters::Ruby do
49
54
 
50
55
  sample("message" => "hello world", "mydate" => "2014-09-23T00:00:00-0800") do
51
56
  # if this eventually breaks because we removed the custom to_json and/or added pretty support to JrJackson then all is good :)
52
- insist { subject["pretty"] } == "{\"message\":\"hello world\",\"mydate\":\"2014-09-23T00:00:00-0800\",\"@version\":\"1\",\"@timestamp\":\"2014-09-23T08:00:00.000Z\"}"
57
+ # non-pretty json does not contain \n
58
+ insist { subject["pretty"].count("\n") } == 0
59
+ # usage of JSON.parse here is to avoid parser-specific order assertions
60
+ insist { JSON.parse(subject["pretty"]) } == JSON.parse("{\"message\":\"hello world\",\"mydate\":\"2014-09-23T00:00:00-0800\",\"@version\":\"1\",\"@timestamp\":\"2014-09-23T08:00:00.000Z\"}")
53
61
  end
54
62
  end
55
63
 
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-14 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- requirement: !ruby/object:Gem::Requirement
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - '>='
17
18
  - !ruby/object:Gem::Version
@@ -19,10 +20,7 @@ dependencies:
19
20
  - - <
20
21
  - !ruby/object:Gem::Version
21
22
  version: 3.0.0
22
- name: logstash-core
23
- prerelease: false
24
- type: :runtime
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - '>='
28
26
  - !ruby/object:Gem::Version
@@ -30,34 +28,36 @@ dependencies:
30
28
  - - <
31
29
  - !ruby/object:Gem::Version
32
30
  version: 3.0.0
31
+ prerelease: false
32
+ type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
+ name: logstash-filter-date
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
34
40
  requirement: !ruby/object:Gem::Requirement
35
41
  requirements:
36
42
  - - '>='
37
43
  - !ruby/object:Gem::Version
38
44
  version: '0'
39
- name: logstash-filter-date
40
45
  prerelease: false
41
46
  type: :runtime
47
+ - !ruby/object:Gem::Dependency
48
+ name: logstash-devutils
42
49
  version_requirements: !ruby/object:Gem::Requirement
43
50
  requirements:
44
51
  - - '>='
45
52
  - !ruby/object:Gem::Version
46
53
  version: '0'
47
- - !ruby/object:Gem::Dependency
48
54
  requirement: !ruby/object:Gem::Requirement
49
55
  requirements:
50
56
  - - '>='
51
57
  - !ruby/object:Gem::Version
52
58
  version: '0'
53
- name: logstash-devutils
54
59
  prerelease: false
55
60
  type: :development
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - '>='
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
61
  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
62
62
  email: info@elastic.co
63
63
  executables: []