fluent-plugin-script 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/README.md +8 -1
- data/fluent-plugin-script.gemspec +2 -2
- data/lib/fluent/plugin/filter_script.rb +9 -4
- data/test/plugin/test_filter_script.rb +6 -4
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b7c2a59a03a4142ff2215547ad71758f0e5dd7f
|
4
|
+
data.tar.gz: e722d96124e96dfedf35b423ab69911053349c4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9851a8d70d497e63d03c9f1d659700cd39a0735ac07017429f5caa82d1780086122e5279302e53a2e218a80d276e4d92b45569252130ec6da8f0db81c029d332
|
7
|
+
data.tar.gz: de4ac6ced65451d860dbc569a22fdd68cabc05c0653196bfe0994f20bae36ca5157b080092d7d20ba3367539ce80bf7787262121222792fce44ad9d29e23bef0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -11,6 +11,13 @@ Fluent filter plugin to external ruby script.
|
|
11
11
|
gem install fluent-plugin-filter-script
|
12
12
|
``
|
13
13
|
|
14
|
+
### Requirements
|
15
|
+
|
16
|
+
| fluent-plugin-script | fluentd |
|
17
|
+
|----------------------|------------|
|
18
|
+
| >= 0.1.0 | >= v0.14.0 |
|
19
|
+
| < 0.0.4 | < v0.14.0 |
|
20
|
+
|
14
21
|
## Configuration
|
15
22
|
|
16
23
|
#### fluent.conf
|
@@ -27,7 +34,7 @@ gem install fluent-plugin-filter-script
|
|
27
34
|
def start
|
28
35
|
super
|
29
36
|
# This is the first method to be called when it starts running
|
30
|
-
# Use it to allocate resources, etc.
|
37
|
+
# Use it to allocate resources, etc.
|
31
38
|
end
|
32
39
|
|
33
40
|
def shutdown
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "fluent-plugin-script"
|
3
|
-
s.version = "0.0
|
3
|
+
s.version = "0.1.0"
|
4
4
|
s.licenses = ["MIT"]
|
5
5
|
s.summary = "Fluentd filter plugin to external ruby script"
|
6
6
|
s.description = s.summary
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
|
14
|
-
s.add_runtime_dependency "fluentd", "
|
14
|
+
s.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
|
15
15
|
s.add_development_dependency "rake", "~> 10.4.2"
|
16
16
|
s.add_development_dependency "test-unit", "~> 3.1.3"
|
17
17
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
require 'fluent/plugin/filter'
|
2
|
+
|
3
|
+
module Fluent::Plugin
|
2
4
|
class ScriptFilter < Filter
|
3
|
-
Plugin.register_filter('script', self)
|
5
|
+
Fluent::Plugin.register_filter('script', self)
|
4
6
|
|
5
7
|
config_param :path, :string
|
6
8
|
|
@@ -10,9 +12,12 @@ module Fluent
|
|
10
12
|
end
|
11
13
|
|
12
14
|
def load_script_file(path)
|
13
|
-
raise ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
|
15
|
+
raise Fluent::ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
|
14
16
|
eval "self.instance_eval do;" + IO.read(path) + ";\nend"
|
15
17
|
end
|
18
|
+
|
19
|
+
def filter(tag, time, record)
|
20
|
+
# Overwritten by evaluated script.
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
|
-
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'fluent/log'
|
3
3
|
require 'fluent/test'
|
4
|
+
require 'fluent/test/driver/filter'
|
4
5
|
require 'fluent/plugin/filter_script'
|
5
6
|
|
6
7
|
class RubyFilterTest < Test::Unit::TestCase
|
@@ -11,7 +12,7 @@ class RubyFilterTest < Test::Unit::TestCase
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def create_driver(conf = '')
|
14
|
-
Test::
|
15
|
+
Test::Driver::Filter.new(Plugin::ScriptFilter).configure(conf)
|
15
16
|
end
|
16
17
|
|
17
18
|
sub_test_case 'configure' do
|
@@ -32,9 +33,10 @@ class RubyFilterTest < Test::Unit::TestCase
|
|
32
33
|
sub_test_case 'filter' do
|
33
34
|
def emit(conf, msg)
|
34
35
|
d = create_driver(conf)
|
35
|
-
d.run {
|
36
|
-
d.
|
37
|
-
}
|
36
|
+
d.run(default_tag: 'test') {
|
37
|
+
d.feed(Fluent::Engine.now, {'foo' => 'bar', 'message' => msg})
|
38
|
+
}
|
39
|
+
d.filtered
|
38
40
|
end
|
39
41
|
test 'execute filter' do
|
40
42
|
conf = "path #{__dir__}/example.rb"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-script
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SNakano
|
@@ -14,16 +14,22 @@ dependencies:
|
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.14.0
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.14.0
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|