fluent-plugin-flatten-hash 0.0.2 → 0.0.3
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.
@@ -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-flatten-hash"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.3"
|
8
8
|
spec.authors = ["Masahiro Sano"]
|
9
9
|
spec.email = ["sabottenda@gmail.com"]
|
10
10
|
spec.description = %q{A fluentd plugin to flatten nested hash structure as a flat record}
|
@@ -25,8 +25,9 @@ module Fluent
|
|
25
25
|
tag = @tag || tag
|
26
26
|
es.each do |time, record|
|
27
27
|
record = flatten_record(record, [])
|
28
|
-
|
29
|
-
|
28
|
+
t = tag.dup
|
29
|
+
filter_record(t, time, record)
|
30
|
+
Engine.emit(t, time, record)
|
30
31
|
end
|
31
32
|
chain.next
|
32
33
|
end
|
@@ -81,4 +81,38 @@ class FlattenHashOutputTest < Test::Unit::TestCase
|
|
81
81
|
], d.records
|
82
82
|
end
|
83
83
|
|
84
|
+
def test_emit_with_add_tag_prefix
|
85
|
+
d = create_driver BASE_CONFIG + %[
|
86
|
+
add_tag_prefix flattened.
|
87
|
+
]
|
88
|
+
d.run do
|
89
|
+
d.emit({'message' => {'foo' => 'bar'}})
|
90
|
+
d.emit({'message' => {'foo' => 'bar'}})
|
91
|
+
d.emit({'message' => {'foo' => 'bar'}})
|
92
|
+
end
|
93
|
+
emits = d.emits
|
94
|
+
emits.each do |e|
|
95
|
+
assert_equal 'flattened.test', e[0]
|
96
|
+
assert_equal 'bar', e[2]["message.foo"]
|
97
|
+
end
|
98
|
+
assert_equal 3, emits.count
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_emit_with_remove_tag_prefix
|
102
|
+
tag = 'prefix.prefix.test'
|
103
|
+
d = create_driver BASE_CONFIG + %[
|
104
|
+
remove_tag_prefix prefix.
|
105
|
+
], tag
|
106
|
+
d.run do
|
107
|
+
d.emit({'message' => {'foo' => 'bar'}})
|
108
|
+
d.emit({'message' => {'foo' => 'bar'}})
|
109
|
+
d.emit({'message' => {'foo' => 'bar'}})
|
110
|
+
end
|
111
|
+
emits = d.emits
|
112
|
+
emits.each do |e|
|
113
|
+
assert_equal 'prefix.test', e[0]
|
114
|
+
assert_equal 'bar', e[2]["message.foo"]
|
115
|
+
end
|
116
|
+
assert_equal 3, emits.count
|
117
|
+
end
|
84
118
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-flatten-hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|