fluent-plugin-flatten 0.0.5 → 0.0.6

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.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'fluent-plugin-flatten'
3
- gem.version = '0.0.5'
3
+ gem.version = '0.0.6'
4
4
  gem.authors = ['Kentaro Kuribayashi']
5
5
  gem.email = ['kentarok@gmail.com']
6
6
  gem.homepage = 'http://github.com/kentaro/fluent-plugin-flatten'
@@ -45,7 +45,10 @@ module Fluent
45
45
  hash = nil
46
46
 
47
47
  begin
48
- hash = JSON.parse(record[key])
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-flatten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: