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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a35f9e721811377cd62973f2f5cf3577d564b64
4
- data.tar.gz: 92cf9d852f7c38c992bb472eb1d9b56510928af1
3
+ metadata.gz: 637e15ff17fe6ead4aac6f2a003abf32c70c0620
4
+ data.tar.gz: b309c9f9d6a7912e0f6582e69322dae5a3f7ea40
5
5
  SHA512:
6
- metadata.gz: eaa5671117602bf5d421e1ba48ed0e1c1e3acebce2cd451658ea2e53d710be2329275cc0c58672e299a13ae8bf1025b94d296f44dd5914d3eeafb2eccccf7dd4
7
- data.tar.gz: 3948c8542fcc827267a476023c7dde83e5e956fb435f500eaa2c1eee4ba3c83a6cd8477dd03798fbdda7c770f72ee7ab856e950aafaab84bb78b684f6a910329
6
+ metadata.gz: d291b9c192708c214e0d2891ab8427f117980e3d01902f5f8591229cbf03ed1a2c78bf44a116116bb4c6abb1445e5a80f5ae677f847b8327ba9041cea691f63d
7
+ data.tar.gz: 28ecbdadee9b13cded79136da417ba65eb940e0ce09cc42221de6c7efc95a9cbe8661b3a05350fa444d41d076971bed91eb0cf5c7ae37459ec0baebf630983f4
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-json_expander"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.1.0"
8
8
  spec.authors = ["Uchio KONDO"]
9
9
  spec.email = ["udzura@udzura.jp"]
10
10
 
@@ -31,7 +31,10 @@ class Fluent::JsonExpanderOutput < Fluent::MultiOutput
31
31
  @mappings = {}
32
32
  @invalid_mapping_keys = []
33
33
 
34
- templates = conf.elements.select{|e| e.name == 'template' }
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.2
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-29 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd