fluent-plugin-map 0.0.5 → 0.0.6
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/.gitignore +1 -0
- data/.travis.yml +10 -0
- data/Appraisals +11 -0
- data/README.markdown +2 -0
- data/fluent-plugin-map.gemspec +5 -3
- data/gemfiles/fluentd_0_10.gemfile +7 -0
- data/gemfiles/fluentd_0_12.gemfile +7 -0
- data/gemfiles/fluentd_0_14.gemfile +7 -0
- data/lib/fluent/plugin/out_map.rb +9 -4
- data/test/plugin/test_out_map.rb +26 -27
- metadata +47 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b302dc881feff3cac6eaeb20d2fb12f9ad1ae4a1
|
4
|
+
data.tar.gz: c3112052a37a51f54261c3fb8f7d5ca1261c20e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f44a0174b92c370bfa09516e8cf4eb1fec642c72811c9b40d338dcbcae71fc1c995b45e8f1fdcee7990ba64af1226406f74e0b7eccbbfdb462389cebf80fa630
|
7
|
+
data.tar.gz: 902ad79813947cc1710a3afe161ecb102372061904982d1a86afef26bbaf675e9ef33f6b3f6f1fd824507f0a13acc2a25fda484feb217533e3babeea37138248
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/README.markdown
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# fluent-plugin-map
|
2
2
|
|
3
|
+
[](https://travis-ci.org/tomity/fluent-plugin-map)
|
4
|
+
|
3
5
|
fluent-plugin-map(out\_map) is the non-buffered plugin that can convert an event log to different event log(s)
|
4
6
|
|
5
7
|
## Example
|
data/fluent-plugin-map.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-map"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.6"
|
7
7
|
s.authors = ["Kohei Tomita"]
|
8
8
|
s.email = ["tommy.fmale@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/tomity/fluent-plugin-map"
|
@@ -17,6 +17,8 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.add_development_dependency "rake"
|
21
|
-
s.add_development_dependency "fluentd", "
|
20
|
+
s.add_development_dependency "rake"
|
21
|
+
s.add_development_dependency "fluentd", [">= 0.10.24", "< 2"]
|
22
|
+
s.add_development_dependency "test-unit", "~> 3.1"
|
23
|
+
s.add_development_dependency "appraisal"
|
22
24
|
end
|
@@ -3,9 +3,14 @@ module Fluent
|
|
3
3
|
class MapOutput < Fluent::Output
|
4
4
|
Fluent::Plugin.register_output('map', self)
|
5
5
|
|
6
|
+
# Define `router` method of v0.12 to support v0.10 or earlier
|
7
|
+
unless method_defined?(:router)
|
8
|
+
define_method("router") { Fluent::Engine }
|
9
|
+
end
|
10
|
+
|
6
11
|
config_param :map, :string, :default => nil
|
7
12
|
config_param :tag, :string, :default => nil
|
8
|
-
config_param :key, :string, :default => nil #
|
13
|
+
config_param :key, :string, :default => nil #deprecated
|
9
14
|
config_param :time, :string, :default => nil
|
10
15
|
config_param :record, :string, :default => nil
|
11
16
|
config_param :multi, :bool, :default => false
|
@@ -29,7 +34,7 @@ module Fluent
|
|
29
34
|
elsif (@tag || @key) && @time && @record
|
30
35
|
"record"
|
31
36
|
else
|
32
|
-
raise ConfigError, "Any of map, 3 parameters(
|
37
|
+
raise ConfigError, "Any of map, 3 parameters(tag, time, and record) or format is required "
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
@@ -69,7 +74,7 @@ module Fluent
|
|
69
74
|
|
70
75
|
def parse_multimap(conf)
|
71
76
|
check_mmap_range(conf)
|
72
|
-
|
77
|
+
|
73
78
|
prev_mmap = nil
|
74
79
|
result_mmaps = (1..MMAP_MAX_NUM).map { |i|
|
75
80
|
mmap = conf["mmap#{i}"]
|
@@ -99,7 +104,7 @@ module Fluent
|
|
99
104
|
begin
|
100
105
|
tag_output_es = do_map(tag, es)
|
101
106
|
tag_output_es.each_pair do |tag, output_es|
|
102
|
-
|
107
|
+
router.emit_stream(tag, output_es)
|
103
108
|
end
|
104
109
|
chain.next
|
105
110
|
tag_output_es
|
data/test/plugin/test_out_map.rb
CHANGED
@@ -16,7 +16,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
def test_tag_convert
|
18
18
|
tag = 'tag'
|
19
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
19
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
20
20
|
record = {'code' => '300'}
|
21
21
|
|
22
22
|
d1 = create_driver %[
|
@@ -27,12 +27,12 @@ class MapOutputTest < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
emits = d1.emits
|
29
29
|
assert_equal 1, emits.length
|
30
|
-
assert_equal ["newtag", time
|
30
|
+
assert_equal ["newtag", time, record], emits[0]
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_convert_multi_tag
|
34
34
|
tag = 'tag'
|
35
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
35
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
36
36
|
record = {'code' => '300'}
|
37
37
|
|
38
38
|
d1 = create_driver %[
|
@@ -44,13 +44,13 @@ class MapOutputTest < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
emits = d1.emits
|
46
46
|
assert_equal 2, emits.length
|
47
|
-
assert_equal ["tag1", time
|
48
|
-
assert_equal ["tag2", time
|
47
|
+
assert_equal ["tag1", time, record], emits[0]
|
48
|
+
assert_equal ["tag2", time, record], emits[1]
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_syntax_error
|
52
52
|
tag = "tag"
|
53
|
-
time = Time.local(2012, 10, 10, 10, 10, 0)
|
53
|
+
time = Time.local(2012, 10, 10, 10, 10, 0).to_i
|
54
54
|
record = {'code' => '300'}
|
55
55
|
|
56
56
|
#map is syntax error
|
@@ -58,7 +58,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
58
58
|
map tag.
|
59
59
|
]
|
60
60
|
d1 = create_driver(syntax_error_config, tag)
|
61
|
-
es = Fluent::OneEventStream.new(time
|
61
|
+
es = Fluent::OneEventStream.new(time, record)
|
62
62
|
chain = Fluent::Test::TestOutputChain.new
|
63
63
|
e = d1.instance.emit(tag, es, chain)
|
64
64
|
assert e.kind_of?(SyntaxError)
|
@@ -66,7 +66,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
66
66
|
|
67
67
|
def test_syntax_error2
|
68
68
|
tag = "tag"
|
69
|
-
time = Time.local(2012, 10, 10, 10, 10, 0)
|
69
|
+
time = Time.local(2012, 10, 10, 10, 10, 0).to_i
|
70
70
|
record = {'code' => '300'}
|
71
71
|
|
72
72
|
#map output lligal format
|
@@ -74,7 +74,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
74
74
|
map tag
|
75
75
|
]
|
76
76
|
d1 = create_driver(syntax_error_config, tag)
|
77
|
-
es = Fluent::OneEventStream.new(time
|
77
|
+
es = Fluent::OneEventStream.new(time, record)
|
78
78
|
chain = Fluent::Test::TestOutputChain.new
|
79
79
|
e = d1.instance.emit(tag, es, chain)
|
80
80
|
assert e.kind_of?(SyntaxError)
|
@@ -82,7 +82,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
82
82
|
|
83
83
|
def test_tag_convert_using_tag_time_record
|
84
84
|
tag = 'tag'
|
85
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
85
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
86
86
|
record = {'code' => '300'}
|
87
87
|
|
88
88
|
d1 = create_driver %[
|
@@ -95,13 +95,13 @@ class MapOutputTest < Test::Unit::TestCase
|
|
95
95
|
end
|
96
96
|
emits = d1.emits
|
97
97
|
assert_equal 1, emits.length
|
98
|
-
assert_equal ["newtag", time
|
98
|
+
assert_equal ["newtag", time, record], emits[0]
|
99
99
|
end
|
100
100
|
|
101
101
|
#deprected specification test
|
102
102
|
def test_tag_convert_using_key_time_record
|
103
103
|
tag = 'tag'
|
104
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
104
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
105
105
|
record = {'code' => '300'}
|
106
106
|
|
107
107
|
d1 = create_driver %[
|
@@ -114,12 +114,12 @@ class MapOutputTest < Test::Unit::TestCase
|
|
114
114
|
end
|
115
115
|
emits = d1.emits
|
116
116
|
assert_equal 1, emits.length
|
117
|
-
assert_equal ["newtag", time
|
117
|
+
assert_equal ["newtag", time, record], emits[0]
|
118
118
|
end
|
119
119
|
|
120
120
|
def test_config_error_tag
|
121
121
|
tag = "tag"
|
122
|
-
time = Time.local(2012, 10, 10, 10, 10, 0)
|
122
|
+
time = Time.local(2012, 10, 10, 10, 10, 0).to_i
|
123
123
|
record = {'code' => '300'}
|
124
124
|
|
125
125
|
#require time
|
@@ -146,7 +146,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
146
146
|
|
147
147
|
def test_config_error_record
|
148
148
|
tag = "tag"
|
149
|
-
time = Time.local(2012, 10, 10, 10, 10, 0)
|
149
|
+
time = Time.local(2012, 10, 10, 10, 10, 0).to_i
|
150
150
|
|
151
151
|
#require record
|
152
152
|
assert_raise(Fluent::ConfigError){
|
@@ -159,8 +159,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
159
159
|
|
160
160
|
def test_config_error_multi
|
161
161
|
tag = "tag"
|
162
|
-
time = Time.local(2012, 10, 10, 10, 10, 0)
|
163
|
-
#time = Time.local(2012, 10, 10, 10, 10, 0)
|
162
|
+
time = Time.local(2012, 10, 10, 10, 10, 0).to_i
|
164
163
|
record = {'code' => '300'}
|
165
164
|
|
166
165
|
#require time
|
@@ -176,7 +175,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
176
175
|
|
177
176
|
def test_timeout
|
178
177
|
tag = 'tag'
|
179
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
178
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
180
179
|
record = {'code' => '300'}
|
181
180
|
|
182
181
|
d1 = create_driver %[
|
@@ -195,11 +194,11 @@ class MapOutputTest < Test::Unit::TestCase
|
|
195
194
|
# Add format test
|
196
195
|
## test format type (map, record, maps)
|
197
196
|
## test Backward compatibility without format
|
198
|
-
##
|
197
|
+
##
|
199
198
|
|
200
199
|
def test_convert_format_map
|
201
200
|
tag = 'tag'
|
202
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
201
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
203
202
|
record = {'code1' => '300', 'code2' => '400'}
|
204
203
|
|
205
204
|
d1 = create_driver %[
|
@@ -212,13 +211,13 @@ class MapOutputTest < Test::Unit::TestCase
|
|
212
211
|
end
|
213
212
|
emits = d1.emits
|
214
213
|
assert_equal 2, emits.length
|
215
|
-
assert_equal ["tag1", time
|
216
|
-
assert_equal ["tag2", time
|
214
|
+
assert_equal ["tag1", time, record["code1"]], emits[0]
|
215
|
+
assert_equal ["tag2", time, record["code2"]], emits[1]
|
217
216
|
end
|
218
217
|
|
219
218
|
def test_tag_convert_format_record
|
220
219
|
tag = 'tag'
|
221
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
220
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
222
221
|
record = {'code' => '300'}
|
223
222
|
|
224
223
|
d1 = create_driver %[
|
@@ -232,12 +231,12 @@ class MapOutputTest < Test::Unit::TestCase
|
|
232
231
|
end
|
233
232
|
emits = d1.emits
|
234
233
|
assert_equal 1, emits.length
|
235
|
-
assert_equal ["newtag", time
|
234
|
+
assert_equal ["newtag", time, record], emits[0]
|
236
235
|
end
|
237
236
|
|
238
237
|
def test_convert_format_multimap
|
239
238
|
tag = 'tag'
|
240
|
-
time = Time.local(2012, 10, 10, 10, 10, 10)
|
239
|
+
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
241
240
|
record = {'code1' => '300', 'code2' => '400'}
|
242
241
|
|
243
242
|
d1 = create_driver %[
|
@@ -250,7 +249,7 @@ class MapOutputTest < Test::Unit::TestCase
|
|
250
249
|
end
|
251
250
|
emits = d1.emits
|
252
251
|
assert_equal 2, emits.length
|
253
|
-
assert_equal ["tag1", time
|
254
|
-
assert_equal ["tag2", time
|
252
|
+
assert_equal ["tag1", time, record["code1"]], emits[0]
|
253
|
+
assert_equal ["tag2", time, record["code2"]], emits[1]
|
255
254
|
end
|
256
255
|
end
|
metadata
CHANGED
@@ -1,43 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Tomita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
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
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fluentd
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.10.24
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '2'
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 0.10.24
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: test-unit
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.1'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.1'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: appraisal
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
41
75
|
description: 'fluent-plugin-map is the non-buffered plugin that can convert an event
|
42
76
|
log to different event log(s). '
|
43
77
|
email:
|
@@ -47,11 +81,16 @@ extensions: []
|
|
47
81
|
extra_rdoc_files: []
|
48
82
|
files:
|
49
83
|
- ".gitignore"
|
84
|
+
- ".travis.yml"
|
85
|
+
- Appraisals
|
50
86
|
- Gemfile
|
51
87
|
- LICENSE
|
52
88
|
- README.markdown
|
53
89
|
- Rakefile
|
54
90
|
- fluent-plugin-map.gemspec
|
91
|
+
- gemfiles/fluentd_0_10.gemfile
|
92
|
+
- gemfiles/fluentd_0_12.gemfile
|
93
|
+
- gemfiles/fluentd_0_14.gemfile
|
55
94
|
- lib/fluent/plugin/out_map.rb
|
56
95
|
- test/helper.rb
|
57
96
|
- test/plugin/test_out_map.rb
|