logstash-filter-ruby 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -1
- data/docs/index.asciidoc +82 -0
- data/lib/logstash/filters/ruby.rb +1 -1
- data/logstash-filter-ruby.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a8891ff589543e9c6b32a92fb0e00bf2d1c183f
|
4
|
+
data.tar.gz: 8ce01783279280b5d28267e9fcdab6ee7cbb49fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc859119ec3eda898ed2fa0b023efc53d45e07c6eb0270060e895a9375e710ca58c0ab030591dfd95b6a200017898dc9aa6852ee89b9e44310ac0e456c5d133
|
7
|
+
data.tar.gz: 1df337ed914ffddb74265e962af81e80d1c38fec4ab5d02472b0f3333afc5a03d97b98f7cf1403744be2e1b6866583a7b890a936297e41f38d727bffe915eed6
|
data/Gemfile
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in logstash-mass_effect.gemspec
|
4
3
|
gemspec
|
4
|
+
|
5
|
+
logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
|
6
|
+
use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
|
7
|
+
|
8
|
+
if Dir.exist?(logstash_path) && use_logstash_source
|
9
|
+
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
10
|
+
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
11
|
+
end
|
data/docs/index.asciidoc
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
:plugin: ruby
|
2
|
+
:type: filter
|
3
|
+
|
4
|
+
///////////////////////////////////////////
|
5
|
+
START - GENERATED VARIABLES, DO NOT EDIT!
|
6
|
+
///////////////////////////////////////////
|
7
|
+
:version: %VERSION%
|
8
|
+
:release_date: %RELEASE_DATE%
|
9
|
+
:changelog_url: %CHANGELOG_URL%
|
10
|
+
:include_path: ../../../../logstash/docs/include
|
11
|
+
///////////////////////////////////////////
|
12
|
+
END - GENERATED VARIABLES, DO NOT EDIT!
|
13
|
+
///////////////////////////////////////////
|
14
|
+
|
15
|
+
[id="plugins-{type}-{plugin}"]
|
16
|
+
|
17
|
+
=== Ruby filter plugin
|
18
|
+
|
19
|
+
include::{include_path}/plugin_header.asciidoc[]
|
20
|
+
|
21
|
+
==== Description
|
22
|
+
|
23
|
+
Execute ruby code.
|
24
|
+
|
25
|
+
For example, to cancel 90% of events, you can do this:
|
26
|
+
[source,ruby]
|
27
|
+
filter {
|
28
|
+
ruby {
|
29
|
+
# Cancel 90% of events
|
30
|
+
code => "event.cancel if rand <= 0.90"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
If you need to create additional events, it cannot be done as in other filters where you would use `yield`,
|
35
|
+
you must use a specific syntax `new_event_block.call(event)` like in this example duplicating the input event
|
36
|
+
[source,ruby]
|
37
|
+
filter {
|
38
|
+
ruby {
|
39
|
+
code => "new_event_block.call(event.clone)"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
[id="plugins-{type}s-{plugin}-options"]
|
45
|
+
==== Ruby Filter Configuration Options
|
46
|
+
|
47
|
+
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
|
48
|
+
|
49
|
+
[cols="<,<,<",options="header",]
|
50
|
+
|=======================================================================
|
51
|
+
|Setting |Input type|Required
|
52
|
+
| <<plugins-{type}s-{plugin}-code>> |<<string,string>>|Yes
|
53
|
+
| <<plugins-{type}s-{plugin}-init>> |<<string,string>>|No
|
54
|
+
|=======================================================================
|
55
|
+
|
56
|
+
Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
|
57
|
+
filter plugins.
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
[id="plugins-{type}s-{plugin}-code"]
|
62
|
+
===== `code`
|
63
|
+
|
64
|
+
* This is a required setting.
|
65
|
+
* Value type is <<string,string>>
|
66
|
+
* There is no default value for this setting.
|
67
|
+
|
68
|
+
The code to execute for every event.
|
69
|
+
You will have an `event` variable available that is the event itself. See the <<event-api,Event API>> for more information.
|
70
|
+
|
71
|
+
[id="plugins-{type}s-{plugin}-init"]
|
72
|
+
===== `init`
|
73
|
+
|
74
|
+
* Value type is <<string,string>>
|
75
|
+
* There is no default value for this setting.
|
76
|
+
|
77
|
+
Any code to execute at logstash startup-time
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
[id="plugins-{type}s-{plugin}-common-options"]
|
82
|
+
include::{include_path}/{type}.asciidoc[]
|
@@ -29,7 +29,7 @@ class LogStash::Filters::Ruby < LogStash::Filters::Base
|
|
29
29
|
config :init, :validate => :string
|
30
30
|
|
31
31
|
# The code to execute for every event.
|
32
|
-
# You will have an `event` variable available that is the event itself.
|
32
|
+
# You will have an `event` variable available that is the event itself. See the <<event-api,Event API>> for more information.
|
33
33
|
config :code, :validate => :string, :required => true
|
34
34
|
|
35
35
|
def register
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-ruby'
|
4
|
-
s.version = '3.0.
|
4
|
+
s.version = '3.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/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files = Dir[
|
14
|
+
s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
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.0.
|
4
|
+
version: 3.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:
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- LICENSE
|
71
71
|
- NOTICE.TXT
|
72
72
|
- README.md
|
73
|
+
- docs/index.asciidoc
|
73
74
|
- lib/logstash/filters/ruby.rb
|
74
75
|
- logstash-filter-ruby.gemspec
|
75
76
|
- spec/filters/ruby_spec.rb
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
version: '0'
|
96
97
|
requirements: []
|
97
98
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.4.8
|
99
100
|
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: Filter for executing ruby code on the event
|