fluent-plugin-split 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-split.gemspec +2 -2
- data/lib/fluent/plugin/out_split.rb +19 -14
- data/spec/out_split_spec.rb +13 -16
- data/spec/spec_helper.rb +4 -4
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afd6e40412617d9fae5f422887f964685d7c06ad
|
4
|
+
data.tar.gz: 437919153b81808689f91c623f7c979842e23526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cedc5e25a61791d5862d0e762733270c77300d9088422e3c0cb6d338b0d567aaf0864d8a946ac7f00e2ee29cc86bb60ba6b8d3a9fc19b13ebe6315f2c8848796
|
7
|
+
data.tar.gz: 9817a726c51b7d2b72563087c8620d4061eea0106048969cae49bdb23c3adff08125c1b00eb068dc2d884ca4423699d3f4ec19deafc5da0b48b5ff461b382682
|
data/fluent-plugin-split.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "fluent-plugin-split"
|
6
|
-
gem.version = "0.0.
|
6
|
+
gem.version = "0.0.4"
|
7
7
|
gem.authors = ["Hiroshi Toyama"]
|
8
8
|
gem.email = "toyama0919@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/toyama0919/fluent-plugin-split"
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.
|
20
|
+
gem.add_development_dependency "fluentd"
|
21
21
|
gem.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
gem.add_development_dependency "rake"
|
23
23
|
gem.add_development_dependency "rspec"
|
@@ -7,20 +7,25 @@ module Fluent
|
|
7
7
|
super
|
8
8
|
end
|
9
9
|
|
10
|
+
# Define `router` method of v0.12 to support v0.10 or earlier
|
11
|
+
unless method_defined?(:router)
|
12
|
+
define_method("router") { Fluent::Engine }
|
13
|
+
end
|
14
|
+
|
10
15
|
config_param :output_tag, :string
|
11
16
|
config_param :output_key, :string
|
12
|
-
config_param :format, :string, :
|
17
|
+
config_param :format, :string, default: 'csv'
|
13
18
|
config_param :key_name, :string
|
14
|
-
config_param :keep_keys, :string, :
|
19
|
+
config_param :keep_keys, :string, default: ''
|
15
20
|
|
16
21
|
def configure(conf)
|
17
22
|
super
|
18
|
-
@keep_keys_array = @keep_keys.split(
|
19
|
-
if @format ==
|
23
|
+
@keep_keys_array = @keep_keys.split(',')
|
24
|
+
if @format == 'csv'
|
20
25
|
@separator = ','
|
21
|
-
elsif @format ==
|
26
|
+
elsif @format == 'tsv'
|
22
27
|
@separator = '\t'
|
23
|
-
elsif @format ==
|
28
|
+
elsif @format == 'space'
|
24
29
|
@separator = /[\s ]/
|
25
30
|
else
|
26
31
|
@separator = @format
|
@@ -28,16 +33,16 @@ module Fluent
|
|
28
33
|
end
|
29
34
|
|
30
35
|
def emit(tag, es, chain)
|
31
|
-
es.each
|
36
|
+
es.each do |time, record|
|
32
37
|
next if record[@key_name].nil?
|
33
|
-
record[@key_name].split(@separator).each
|
34
|
-
result = {@output_key => item}
|
35
|
-
record.each
|
38
|
+
record[@key_name].split(@separator).each do|item|
|
39
|
+
result = { @output_key => item }
|
40
|
+
record.each do|key, value|
|
36
41
|
result[key] = value if @keep_keys_array.include?(key)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
42
|
+
end
|
43
|
+
router.emit(output_tag, time, result)
|
44
|
+
end
|
45
|
+
end
|
41
46
|
chain.next
|
42
47
|
rescue => e
|
43
48
|
$log.warn e.message
|
data/spec/out_split_spec.rb
CHANGED
@@ -6,69 +6,66 @@ class SplitOutputTest < Test::Unit::TestCase
|
|
6
6
|
Fluent::Test.setup
|
7
7
|
end
|
8
8
|
|
9
|
-
def create_driver(conf = CONFIG, tag='test')
|
9
|
+
def create_driver(conf = CONFIG, tag = 'test')
|
10
10
|
d = Fluent::Test::BufferedOutputTestDriver.new(Fluent::SplitOutput, tag).configure(conf)
|
11
11
|
d
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_configure_error
|
15
|
-
assert_raise(Fluent::ConfigError)
|
15
|
+
assert_raise(Fluent::ConfigError) do
|
16
16
|
d = create_driver %[
|
17
17
|
output_key keyword
|
18
18
|
format csv
|
19
19
|
key_name keywords
|
20
20
|
keep_keys site
|
21
21
|
]
|
22
|
-
|
22
|
+
end
|
23
23
|
|
24
24
|
# not define output_key
|
25
|
-
assert_raise(Fluent::ConfigError)
|
25
|
+
assert_raise(Fluent::ConfigError) do
|
26
26
|
d = create_driver %[
|
27
27
|
output_tag split.keyword
|
28
28
|
format csv
|
29
29
|
key_name keywords
|
30
30
|
keep_keys site
|
31
31
|
]
|
32
|
-
|
32
|
+
end
|
33
33
|
|
34
34
|
# not define output_key
|
35
|
-
assert_raise(Fluent::ConfigError)
|
35
|
+
assert_raise(Fluent::ConfigError) do
|
36
36
|
d = create_driver %[
|
37
37
|
output_key keyword
|
38
38
|
output_tag split.keyword
|
39
39
|
format csv
|
40
40
|
keep_keys site
|
41
41
|
]
|
42
|
-
|
42
|
+
end
|
43
43
|
|
44
|
-
assert_raise(Fluent::ConfigError)
|
44
|
+
assert_raise(Fluent::ConfigError) do
|
45
45
|
d = create_driver %[
|
46
46
|
output_tag split.keyword
|
47
47
|
output_key keyword
|
48
48
|
]
|
49
|
-
|
50
|
-
|
49
|
+
end
|
51
50
|
end
|
52
51
|
|
53
52
|
def test_configure
|
54
53
|
# not define format(default csv)
|
55
|
-
assert_nothing_raised(Fluent::ConfigError)
|
54
|
+
assert_nothing_raised(Fluent::ConfigError) do
|
56
55
|
d = create_driver %[
|
57
56
|
output_tag split.keyword
|
58
57
|
output_key keyword
|
59
58
|
key_name keywords
|
60
59
|
keep_keys site
|
61
60
|
]
|
62
|
-
|
61
|
+
end
|
63
62
|
|
64
|
-
assert_nothing_raised(Fluent::ConfigError)
|
63
|
+
assert_nothing_raised(Fluent::ConfigError) do
|
65
64
|
d = create_driver %[
|
66
65
|
output_tag split.keyword
|
67
66
|
output_key keyword
|
68
67
|
key_name keywords
|
69
68
|
]
|
70
|
-
|
71
|
-
|
69
|
+
end
|
72
70
|
end
|
73
|
-
|
74
71
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,7 @@ begin
|
|
4
4
|
Bundler.setup(:default, :development)
|
5
5
|
rescue Bundler::BundlerError => e
|
6
6
|
$stderr.puts e.message
|
7
|
-
$stderr.puts
|
7
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
10
|
require 'test/unit'
|
@@ -12,13 +12,13 @@ require 'test/unit'
|
|
12
12
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
13
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
14
|
require 'fluent/test'
|
15
|
-
unless ENV.
|
15
|
+
unless ENV.key?('VERBOSE')
|
16
16
|
nulllogger = Object.new
|
17
|
-
nulllogger.instance_eval
|
17
|
+
nulllogger.instance_eval do|obj|
|
18
18
|
def method_missing(method, *args)
|
19
19
|
# pass
|
20
20
|
end
|
21
|
-
|
21
|
+
end
|
22
22
|
$log = nulllogger
|
23
23
|
end
|
24
24
|
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-split
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Toyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: spork
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Output Split String Plugin for fluentd
|
@@ -100,9 +100,9 @@ executables: []
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
-
- .gitignore
|
104
|
-
- .rspec
|
105
|
-
- .travis.yml
|
103
|
+
- ".gitignore"
|
104
|
+
- ".rspec"
|
105
|
+
- ".travis.yml"
|
106
106
|
- CHANGELOG.md
|
107
107
|
- Gemfile
|
108
108
|
- LICENSE
|
@@ -122,20 +122,21 @@ require_paths:
|
|
122
122
|
- lib
|
123
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.4.2
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Output Split String Plugin for fluentd
|
139
139
|
test_files:
|
140
140
|
- spec/out_split_spec.rb
|
141
141
|
- spec/spec_helper.rb
|
142
|
+
has_rdoc: false
|