logstash-filter-ruby 0.1.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -0
- data/NOTICE.TXT +5 -0
- data/README.md +1 -1
- data/lib/logstash/filters/ruby.rb +7 -3
- data/logstash-filter-ruby.gemspec +1 -1
- data/spec/filters/ruby_spec.rb +26 -0
- metadata +18 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55cb524641f1a0310e905de491cd10143c7a6fdf
|
4
|
+
data.tar.gz: 68154628f270f8aba610b799ad81366a112fd4cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63df0659d9aa64a05abcd2969e58051c03a42589978557141cce54c63f2d4f76a3665ba5d44cf657213a86444f574194a7bf757d05d5d7b3ba2c542366dff69
|
7
|
+
data.tar.gz: 5dbecadfc4fecd5a79906917ce2bd463790eb53b1f50d5b4acbe97759f56077b3184d25f1761bf7bfb70abf61ee2adc35c5b1b3c6f5489e434403593af7b2ff6
|
data/CHANGELOG.md
ADDED
File without changes
|
data/NOTICE.TXT
ADDED
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Logstash provides infrastructure to automatically generate documentation for thi
|
|
13
13
|
|
14
14
|
## Need Help?
|
15
15
|
|
16
|
-
Need help? Try #logstash on freenode IRC or the logstash
|
16
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
17
17
|
|
18
18
|
## Developing
|
19
19
|
|
@@ -34,8 +34,12 @@ class LogStash::Filters::Ruby < LogStash::Filters::Base
|
|
34
34
|
def filter(event)
|
35
35
|
return unless filter?(event)
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
begin
|
38
|
+
@codeblock.call(event)
|
39
|
+
filter_matched(event)
|
40
|
+
rescue Exception => e
|
41
|
+
@logger.error("Ruby exception occurred: #{e}")
|
42
|
+
event.tag("_rubyexception")
|
43
|
+
end
|
40
44
|
end # def filter
|
41
45
|
end # class LogStash::Filters::Ruby
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-ruby'
|
4
|
-
s.version = '0.
|
4
|
+
s.version = '1.0.0'
|
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"
|
data/spec/filters/ruby_spec.rb
CHANGED
@@ -52,4 +52,30 @@ describe LogStash::Filters::Ruby do
|
|
52
52
|
insist { subject["pretty"] } == "{\"message\":\"hello world\",\"mydate\":\"2014-09-23T00:00:00-0800\",\"@version\":\"1\",\"@timestamp\":\"2014-09-23T08:00:00.000Z\"}"
|
53
53
|
end
|
54
54
|
end
|
55
|
+
|
56
|
+
describe "catch all exceptions and don't let them ruin your day buy stopping the entire worker" do
|
57
|
+
# If exception is raised, it stops entine processing pipeline, and never resumes
|
58
|
+
# Code section should always be wrapped with begin/rescue
|
59
|
+
config <<-CONFIG
|
60
|
+
filter {
|
61
|
+
date {
|
62
|
+
match => [ "mydate", "ISO8601" ]
|
63
|
+
locale => "en"
|
64
|
+
timezone => "UTC"
|
65
|
+
}
|
66
|
+
ruby {
|
67
|
+
init => "require 'json'"
|
68
|
+
code => "raise 'You shall not pass'"
|
69
|
+
add_tag => ["ok"]
|
70
|
+
}
|
71
|
+
}
|
72
|
+
CONFIG
|
73
|
+
|
74
|
+
sample("message" => "hello world", "mydate" => "2014-09-23T00:00:00-0800") do
|
75
|
+
insist { subject["mydate"] } == "2014-09-23T00:00:00-0800"
|
76
|
+
insist { subject["tags"] } == ["_rubyexception"]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
55
80
|
end
|
81
|
+
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
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: 2.0.0
|
22
|
-
|
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: 2.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: []
|
@@ -65,9 +65,11 @@ extensions: []
|
|
65
65
|
extra_rdoc_files: []
|
66
66
|
files:
|
67
67
|
- .gitignore
|
68
|
+
- CHANGELOG.md
|
68
69
|
- CONTRIBUTORS
|
69
70
|
- Gemfile
|
70
71
|
- LICENSE
|
72
|
+
- NOTICE.TXT
|
71
73
|
- README.md
|
72
74
|
- Rakefile
|
73
75
|
- lib/logstash/filters/ruby.rb
|
@@ -95,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
97
|
version: '0'
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.2.2
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: Filter for executing ruby code on the event
|