fluent-plugin-flatten 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -45,7 +45,10 @@ module Fluent
|
|
45
45
|
hash = nil
|
46
46
|
|
47
47
|
begin
|
48
|
-
|
48
|
+
# XXX work-around
|
49
|
+
# fluentd seems to escape json value excessively
|
50
|
+
json = record[key].gsub(/\\"/, '"')
|
51
|
+
hash = JSON.parse(json)
|
49
52
|
rescue JSON::ParserError
|
50
53
|
return flattened
|
51
54
|
end
|
@@ -52,6 +52,11 @@ class FlattenOutputTest < Test::Unit::TestCase
|
|
52
52
|
flattened = d.instance.flatten({ 'foo' => '{"bar" : "baz"}', 'hoge' => 'fuga' })
|
53
53
|
assert_equal({ 'foo.bar' => { 'value' => 'baz' } }, flattened)
|
54
54
|
|
55
|
+
# XXX work-around
|
56
|
+
# fluentd seems to escape json value excessively
|
57
|
+
flattened = d.instance.flatten({ 'foo' => '{\"bar\" : \"baz\"}' })
|
58
|
+
assert_equal({ 'foo.bar' => { 'value' => 'baz' } }, flattened)
|
59
|
+
|
55
60
|
# when empty value is passed
|
56
61
|
flattened = d.instance.flatten({ 'foo' => '' })
|
57
62
|
assert_equal({}, flattened)
|