fluent-plugin-mongo 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +1 -2
- data/ChangeLog +6 -0
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_mongo.rb +17 -10
- data/lib/fluent/plugin/out_mongo_replset.rb +3 -0
- data/test/plugin/out_mongo.rb +12 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0f06d14dcaa01affed6b682b47507f1316382b3
|
4
|
+
data.tar.gz: 45949ee4d712a3383a5d1d0950dbc4777023df67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d46e3642f3e5ea270751f63d8f0e763d368e87a1d01c0bc87ef4b5e1f53c69dc866a7813129e3df0eda442c46850e57aa3e319397c96a77329347edf1828585f
|
7
|
+
data.tar.gz: 58520fb47980924087cd3daecc2e9913064dd8874e0ea1204be5af83132cf7bd66678a1b18dcf4e8c9f9786d74d8ec3232bf1bd8ce06d7f04ab84d5c1ead9440
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.4
|
@@ -253,18 +253,25 @@ module Fluent
|
|
253
253
|
version
|
254
254
|
end
|
255
255
|
|
256
|
-
def replace_key_of_hash(
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
256
|
+
def replace_key_of_hash(hash_or_array, pattern, replacement)
|
257
|
+
case hash_or_array
|
258
|
+
when Array
|
259
|
+
hash_or_array.map do |elm|
|
260
|
+
replace_key_of_hash(elm, pattern, replacement)
|
261
|
+
end
|
262
|
+
when Hash
|
263
|
+
result = Hash.new
|
264
|
+
hash_or_array.each_pair do |k, v|
|
265
|
+
k = k.gsub(pattern, replacement)
|
266
|
+
|
267
|
+
if v.is_a?(Hash) || v.is_a?(Array)
|
268
|
+
result[k] = replace_key_of_hash(v, pattern, replacement)
|
269
|
+
else
|
270
|
+
result[k] = v
|
271
|
+
end
|
265
272
|
end
|
273
|
+
result
|
266
274
|
end
|
267
|
-
result
|
268
275
|
end
|
269
276
|
end
|
270
277
|
end
|
@@ -4,6 +4,9 @@ module Fluent
|
|
4
4
|
class MongoOutputReplset < MongoOutput
|
5
5
|
Plugin.register_output('mongo_replset', self)
|
6
6
|
|
7
|
+
config_set_default :include_tag_key, false
|
8
|
+
config_set_default :include_time_key, true
|
9
|
+
|
7
10
|
config_param :nodes, :string
|
8
11
|
config_param :name, :string, :default => nil
|
9
12
|
config_param :read, :string, :default => nil
|
data/test/plugin/out_mongo.rb
CHANGED
@@ -25,6 +25,7 @@ class MongoOutputTest < Test::Unit::TestCase
|
|
25
25
|
type mongo
|
26
26
|
database #{MONGO_DB_DB}
|
27
27
|
collection #{collection_name}
|
28
|
+
include_time_key true # TestDriver ignore config_set_default?
|
28
29
|
]
|
29
30
|
end
|
30
31
|
|
@@ -136,15 +137,21 @@ class MongoOutputTest < Test::Unit::TestCase
|
|
136
137
|
|
137
138
|
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
138
139
|
d.emit({
|
139
|
-
"foo.
|
140
|
+
"foo.bar1" => {
|
140
141
|
"$foo$bar" => "baz"
|
141
|
-
}
|
142
|
+
},
|
143
|
+
"foo.bar2" => [
|
144
|
+
{
|
145
|
+
"$foo$bar" => "baz"
|
146
|
+
}
|
147
|
+
],
|
142
148
|
}, time)
|
143
149
|
d.run
|
144
150
|
|
145
151
|
documents = get_documents
|
146
152
|
assert_equal(1, documents.size)
|
147
|
-
assert_equal("baz", documents[0]["
|
153
|
+
assert_equal("baz", documents[0]["foo_dot_bar1"]["_dollar_foo$bar"])
|
154
|
+
assert_equal("baz", documents[0]["foo_dot_bar2"][0]["_dollar_foo$bar"])
|
148
155
|
assert_equal(0, documents.select { |e| e.has_key?(Fluent::MongoOutput::BROKEN_DATA_KEY)}.size)
|
149
156
|
end
|
150
157
|
|
@@ -231,6 +238,7 @@ class MongoReplOutputTest < MongoOutputTest
|
|
231
238
|
collection #{collection_name}
|
232
239
|
nodes #{build_seeds(3).join(',')}
|
233
240
|
num_retries 30
|
241
|
+
include_time_key true # TestDriver ignore config_set_default?
|
234
242
|
]
|
235
243
|
end
|
236
244
|
|
@@ -260,3 +268,4 @@ class MongoReplOutputTest < MongoOutputTest
|
|
260
268
|
assert_equal({:ssl => false}, d.instance.connection_options)
|
261
269
|
end
|
262
270
|
end
|
271
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nakagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.2.
|
131
|
+
rubygems_version: 2.2.2
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: MongoDB plugin for Fluentd
|