fluent-plugin-json_expander 0.0.2 → 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/fluent-plugin-json_expander.gemspec +1 -1
- data/lib/fluent/plugin/out_json_expander.rb +19 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 637e15ff17fe6ead4aac6f2a003abf32c70c0620
|
4
|
+
data.tar.gz: b309c9f9d6a7912e0f6582e69322dae5a3f7ea40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d291b9c192708c214e0d2891ab8427f117980e3d01902f5f8591229cbf03ed1a2c78bf44a116116bb4c6abb1445e5a80f5ae677f847b8327ba9041cea691f63d
|
7
|
+
data.tar.gz: 28ecbdadee9b13cded79136da417ba65eb940e0ce09cc42221de6c7efc95a9cbe8661b3a05350fa444d41d076971bed91eb0cf5c7ae37459ec0baebf630983f4
|
@@ -31,7 +31,10 @@ class Fluent::JsonExpanderOutput < Fluent::MultiOutput
|
|
31
31
|
@mappings = {}
|
32
32
|
@invalid_mapping_keys = []
|
33
33
|
|
34
|
-
|
34
|
+
# touch_recursive: read and throw away to supress unread configuration warning
|
35
|
+
# ref: fluent-plugin-forest/lib/fluent/plugin/out_forest.rb
|
36
|
+
templates = conf.elements.select{|e| touch_recursive(e).name == 'template' }
|
37
|
+
|
35
38
|
if templates.size != 1
|
36
39
|
raise Fluent::ConfigError, "Just 1 template must be contained"
|
37
40
|
end
|
@@ -40,6 +43,16 @@ class Fluent::JsonExpanderOutput < Fluent::MultiOutput
|
|
40
43
|
@expand_target_keys = scan_keys(@template)
|
41
44
|
end
|
42
45
|
|
46
|
+
def touch_recursive(e)
|
47
|
+
e.keys.each do |k|
|
48
|
+
e[k]
|
49
|
+
end
|
50
|
+
e.elements.each do |child|
|
51
|
+
touch_recursive(child)
|
52
|
+
end
|
53
|
+
e
|
54
|
+
end
|
55
|
+
|
43
56
|
def emit(tag, es, chain)
|
44
57
|
if @remove_prefix and
|
45
58
|
((tag.start_with?(@removed_prefix_string) and tag.length > @removed_length) or tag == @remove_prefix)
|
@@ -65,7 +78,6 @@ class Fluent::JsonExpanderOutput < Fluent::MultiOutput
|
|
65
78
|
@mappings.values.each do |output|
|
66
79
|
output.shutdown
|
67
80
|
end
|
68
|
-
@mappings.clear
|
69
81
|
end
|
70
82
|
|
71
83
|
private
|
@@ -170,4 +182,9 @@ class Fluent::JsonExpanderOutput < Fluent::MultiOutput
|
|
170
182
|
end
|
171
183
|
""
|
172
184
|
end
|
185
|
+
|
186
|
+
# For testing...
|
187
|
+
def mappings
|
188
|
+
@mappings
|
189
|
+
end
|
173
190
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-json_expander
|
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
|
- Uchio KONDO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|