fluent-plugin-map 0.0.6 → 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/README.markdown +1 -1
- data/fluent-plugin-map.gemspec +5 -4
- data/lib/fluent/plugin/out_map.rb +28 -4
- data/test/plugin/test_out_map.rb +12 -17
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4ad3a04fd6a20ad899c5bbcdc8677c4a168d99e
|
4
|
+
data.tar.gz: e71017da3b0fc6996bd61cda02a65250115e0c0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b31eac601f6eaca70e7a13248ffd0d9933577e457358a41ad52cda3652d79fa4d13e2295d126d86a8a543bd77f363e60a52042fc3af76f2e5cc2a74e9d564649
|
7
|
+
data.tar.gz: cae9c24f03345592f87087e3ac1ab1f5557bbc57cd3825fea2c94a94956e4201f0771f4d5dcde31e53c54e761eb8f3f239c1e4f3025c279dc1b3001a6334e7bc
|
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# fluent-plugin-map
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/fluent-plugins-nursery/fluent-plugin-map.svg?branch=master)](https://travis-ci.org/fluent-plugins-nursery/fluent-plugin-map)
|
4
4
|
|
5
5
|
fluent-plugin-map(out\_map) is the non-buffered plugin that can convert an event log to different event log(s)
|
6
6
|
|
data/fluent-plugin-map.gemspec
CHANGED
@@ -3,10 +3,10 @@ $:.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
|
7
|
-
s.authors = ["Kohei Tomita"]
|
8
|
-
s.email = ["tommy.fmale@gmail.com"]
|
9
|
-
s.homepage = "https://github.com/
|
6
|
+
s.version = "0.1.0"
|
7
|
+
s.authors = ["Kohei Tomita", "Hiroshi Hatake", "Kenji Okomoto"]
|
8
|
+
s.email = ["tommy.fmale@gmail.com", "cosmo0920.oucc@gmail.com", "okkez000@gmail.com"]
|
9
|
+
s.homepage = "https://github.com/fluent-plugins-nursery/fluent-plugin-map"
|
10
10
|
s.summary = %q{fluent-plugin-map is the non-buffered plugin that can convert an event log to different event log(s). }
|
11
11
|
s.description = %q{fluent-plugin-map is the non-buffered plugin that can convert an event log to different event log(s). }
|
12
12
|
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
|
+
s.license = "Apache-2.0"
|
19
20
|
|
20
21
|
s.add_development_dependency "rake"
|
21
22
|
s.add_development_dependency "fluentd", [">= 0.10.24", "< 2"]
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# fluent-plugin-map
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
|
2
17
|
module Fluent
|
3
18
|
class MapOutput < Fluent::Output
|
@@ -8,6 +23,10 @@ module Fluent
|
|
8
23
|
define_method("router") { Fluent::Engine }
|
9
24
|
end
|
10
25
|
|
26
|
+
unless method_defined?(:log)
|
27
|
+
define_method("log") { $log }
|
28
|
+
end
|
29
|
+
|
11
30
|
config_param :map, :string, :default => nil
|
12
31
|
config_param :tag, :string, :default => nil
|
13
32
|
config_param :key, :string, :default => nil #deprecated
|
@@ -24,6 +43,11 @@ module Fluent
|
|
24
43
|
@format = determine_format()
|
25
44
|
configure_format()
|
26
45
|
@map = create_map(conf)
|
46
|
+
singleton_class.module_eval(<<-CODE)
|
47
|
+
def map_func(tag, time, record)
|
48
|
+
#{@map}
|
49
|
+
end
|
50
|
+
CODE
|
27
51
|
end
|
28
52
|
|
29
53
|
def determine_format()
|
@@ -110,7 +134,7 @@ module Fluent
|
|
110
134
|
tag_output_es
|
111
135
|
rescue SyntaxError => e
|
112
136
|
chain.next
|
113
|
-
|
137
|
+
log.error "map command is syntax error: #{@map}"
|
114
138
|
e #for test
|
115
139
|
end
|
116
140
|
end
|
@@ -124,7 +148,7 @@ module Fluent
|
|
124
148
|
raise SyntaxError.new
|
125
149
|
end
|
126
150
|
tag_output_es[tag].add(time, record)
|
127
|
-
|
151
|
+
log.trace { [tag, time, record].inspect }
|
128
152
|
end
|
129
153
|
tag_output_es
|
130
154
|
end
|
@@ -132,7 +156,7 @@ module Fluent
|
|
132
156
|
def generate_tuples(tag, es)
|
133
157
|
tuples = []
|
134
158
|
es.each {|time, record|
|
135
|
-
new_tuple =
|
159
|
+
new_tuple = map_func(tag, time, record)
|
136
160
|
tuples.concat new_tuple
|
137
161
|
}
|
138
162
|
tuples
|
@@ -144,7 +168,7 @@ module Fluent
|
|
144
168
|
yield
|
145
169
|
}
|
146
170
|
rescue Timeout::Error
|
147
|
-
|
171
|
+
log.error {"Timeout: #{Time.at(time)} #{tag} #{record.inspect}"}
|
148
172
|
end
|
149
173
|
end
|
150
174
|
end
|
data/test/plugin/test_out_map.rb
CHANGED
@@ -57,11 +57,9 @@ class MapOutputTest < Test::Unit::TestCase
|
|
57
57
|
syntax_error_config = %[
|
58
58
|
map tag.
|
59
59
|
]
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
e = d1.instance.emit(tag, es, chain)
|
64
|
-
assert e.kind_of?(SyntaxError)
|
60
|
+
assert_raise SyntaxError do
|
61
|
+
d1 = create_driver(syntax_error_config, tag)
|
62
|
+
end
|
65
63
|
end
|
66
64
|
|
67
65
|
def test_syntax_error2
|
@@ -173,22 +171,19 @@ class MapOutputTest < Test::Unit::TestCase
|
|
173
171
|
}
|
174
172
|
end
|
175
173
|
|
176
|
-
def
|
174
|
+
def test_config_error_sleep
|
177
175
|
tag = 'tag'
|
178
176
|
time = Time.local(2012, 10, 10, 10, 10, 10).to_i
|
179
177
|
record = {'code' => '300'}
|
180
178
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
190
|
-
emits = d1.emits
|
191
|
-
assert_equal 0, emits.length
|
179
|
+
assert_raise(SyntaxError) {
|
180
|
+
create_driver %[
|
181
|
+
key "newtag"
|
182
|
+
time sleep 10
|
183
|
+
record record
|
184
|
+
timeout 1s
|
185
|
+
], tag
|
186
|
+
}
|
192
187
|
end
|
193
188
|
|
194
189
|
# Add format test
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Tomita
|
8
|
+
- Hiroshi Hatake
|
9
|
+
- Kenji Okomoto
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: rake
|
@@ -76,6 +78,8 @@ description: 'fluent-plugin-map is the non-buffered plugin that can convert an e
|
|
76
78
|
log to different event log(s). '
|
77
79
|
email:
|
78
80
|
- tommy.fmale@gmail.com
|
81
|
+
- cosmo0920.oucc@gmail.com
|
82
|
+
- okkez000@gmail.com
|
79
83
|
executables: []
|
80
84
|
extensions: []
|
81
85
|
extra_rdoc_files: []
|
@@ -94,8 +98,9 @@ files:
|
|
94
98
|
- lib/fluent/plugin/out_map.rb
|
95
99
|
- test/helper.rb
|
96
100
|
- test/plugin/test_out_map.rb
|
97
|
-
homepage: https://github.com/
|
98
|
-
licenses:
|
101
|
+
homepage: https://github.com/fluent-plugins-nursery/fluent-plugin-map
|
102
|
+
licenses:
|
103
|
+
- Apache-2.0
|
99
104
|
metadata: {}
|
100
105
|
post_install_message:
|
101
106
|
rdoc_options: []
|
@@ -113,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
118
|
version: '0'
|
114
119
|
requirements: []
|
115
120
|
rubyforge_project: fluent-plugin-map
|
116
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.8
|
117
122
|
signing_key:
|
118
123
|
specification_version: 4
|
119
124
|
summary: fluent-plugin-map is the non-buffered plugin that can convert an event log
|