fluent-plugin-split-array 0.0.1 → 0.0.2
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 +4 -4
- data/.travis.yml +4 -0
- data/README.md +4 -1
- data/fluent-plugin-split-array.gemspec +1 -1
- data/lib/fluent/plugin/filter_split_array.rb +8 -1
- data/test/plugin/test_filter_split_array.rb +17 -3
- 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: 1f5c3413444637178f42ba549aca2c6ce8d71b27
|
4
|
+
data.tar.gz: 2ef6be4bc65f6efa60a05970c9900ff7b5f57571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f285001bae38504aa6c1d7f2e4887d3913cd14f22dde9667784bf234c4b2d3bf361f4edf25d08ee5679f3bd2d69088bce062f156bedf393f56e9e47ed54cb1
|
7
|
+
data.tar.gz: 7cee5378a189ecd79d75bff95e01c878328f3f305be0a483ee7e1d625051360301aa3f4058cbc73d80e690036643dbce12fad11cb841a88c0178b96f12ecc1c7
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Fluent filter plugin to split array
|
4
4
|
|
5
|
+
[](https://travis-ci.org/SNakano/fluent-plugin-split-array)
|
6
|
+
[](https://rubygems.org/gems/fluent-plugin-split-array)
|
7
|
+
|
8
|
+
|
5
9
|
## install
|
6
10
|
|
7
11
|
```
|
@@ -53,4 +57,3 @@ Monitoring RabbitMQ all queues status
|
|
53
57
|
type stdout
|
54
58
|
</match>
|
55
59
|
```
|
56
|
-
|
@@ -1,9 +1,16 @@
|
|
1
1
|
module Fluent
|
2
2
|
class SplitArrayFilter < Filter
|
3
3
|
Fluent::Plugin.register_filter('split_array', self)
|
4
|
+
|
5
|
+
desc "Key name to split"
|
6
|
+
config_param :split_key, :string, default: nil
|
7
|
+
|
4
8
|
def filter_stream(tag, es)
|
5
9
|
new_es = MultiEventStream.new
|
6
|
-
es.each {|time, record|
|
10
|
+
es.each {|time, record|
|
11
|
+
target_record = @split_key.nil? ? record : record[@split_key] || {}
|
12
|
+
split(time, target_record, new_es)
|
13
|
+
}
|
7
14
|
new_es
|
8
15
|
end
|
9
16
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'test/unit'
|
2
3
|
require 'fluent/log'
|
3
4
|
require 'fluent/test'
|
@@ -10,8 +11,8 @@ class RubyFilterTest < Test::Unit::TestCase
|
|
10
11
|
Fluent::Test.setup
|
11
12
|
end
|
12
13
|
|
13
|
-
def emit(msg)
|
14
|
-
d = Test::FilterTestDriver.new(SplitArrayFilter).configure(
|
14
|
+
def emit(msg, conf='')
|
15
|
+
d = Test::FilterTestDriver.new(SplitArrayFilter).configure(conf, true)
|
15
16
|
d.run {
|
16
17
|
d.emit(msg, Fluent::Engine.now)
|
17
18
|
}.filtered
|
@@ -27,9 +28,22 @@ class RubyFilterTest < Test::Unit::TestCase
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
test 'execute to hash' do
|
30
|
-
msg = {'a' => 'b', 'c' => 'd'}
|
31
|
+
msg = {'a' => 'b', 'c' => 'd'}
|
31
32
|
es = emit(msg)
|
32
33
|
assert_equal(msg, es.first[1])
|
33
34
|
end
|
35
|
+
test 'execute to array with split_key' do
|
36
|
+
msg = {'key1' => [{'a' => 'b'}, {'a' => 'c'}]}
|
37
|
+
es = emit(msg, conf='split_key key1')
|
38
|
+
assert_equal(msg['key1'].count, es.count)
|
39
|
+
es.each_with_index do |e, i|
|
40
|
+
assert_equal(msg['key1'][i], e[1])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
test 'execute to hash with split_key' do
|
44
|
+
msg = {'key1' => {'a' => 'b', 'c' => 'd'}}
|
45
|
+
es = emit(msg, conf='split_key key1')
|
46
|
+
assert_equal(msg['key1'], es.first[1])
|
47
|
+
end
|
34
48
|
end
|
35
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-split-array
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SNakano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -59,6 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".travis.yml"
|
62
63
|
- Gemfile
|
63
64
|
- LICENSE
|
64
65
|
- README.md
|
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
87
|
version: '0'
|
87
88
|
requirements: []
|
88
89
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.6.11
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: Fluentd filter plugin to split array
|