fluent-plugin-json-in-json 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 868c883a280025a4d5ac0260b062e12f48b2c3d4
4
- data.tar.gz: 7f6a866ed648c2eca97d265bec148c8a11660040
3
+ metadata.gz: 3789a3629e0e671eb764ab5595d8413b5f81cd94
4
+ data.tar.gz: 61dabe27f92345bd68d63f35d1a21073846be1ea
5
5
  SHA512:
6
- metadata.gz: 5aecc10aa4d2f649a22b2d6166f2eb8bb1ebbd151503b6ed7fa71c6e6f1607d87d3081e9bb5f3d85220c214cc0ee63099c1892ab0d9a9da9ecc4a839d315708b
7
- data.tar.gz: 18ba0722a89c88ad0a1be633721bfcbed9acfaf8ee8efa4f4c93f9b154055879076b73dfbe376d8cd4e0182fa3c29da11cc301f34b1049e42cbba4a96cbcf25a
6
+ metadata.gz: b5adece8e91b855924b70754304d4e03aaf5a5c68bef3721e99ad2b775aad74a60135478421cc9604011a4cbd01d07ea69a9359ef5afa0b238ad6fff8615f1f3
7
+ data.tar.gz: 4d5f2020967256ac3898fb73d35f9c4224a962a152cecdb7bc122230ca0ce75dd1fec1bb6d5b10bb9d0c1721c5c8353d1846deb979810961c8d8bff16df4eb18
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # fluent-plugon-json-in-json
2
2
 
3
3
  This fluentd parser plugin parses JSON log lines with nested JSON strings. For
4
- example, given a docker log of ``{"log": "{\"foo\": \"bar\"}"}, the log record
4
+ example, given a docker log of ``{"log": "{\"foo\": \"bar\"}"}``, the log record
5
5
  will be parsed into ``{:log => { :foo => "bar" }}``.
6
6
 
7
7
  ## Installation
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "fluent-plugin-json-in-json"
4
- spec.version = "0.1.3"
4
+ spec.version = "0.1.4"
5
5
  spec.authors = ["Gavin M. Roy"]
6
6
  spec.email = ["gavinmroy@gmail.com"]
7
7
  spec.description = %q{Parser plugin that parses JSON attributes with JSON strings in them}
@@ -39,14 +39,17 @@ module Fluent
39
39
  end
40
40
  end
41
41
 
42
+ values = Hash.new
42
43
  record.each do |k, v|
43
- if v[0] == '{' and v[-1] == '}'
44
- h = Yajl.load(v)
45
- h.each do |vk, vv|
46
- record[vk] = vv
44
+ if v[0] == '{'
45
+ deserialized = Yajl.load(v)
46
+ if deserialized.is_a?(Hash)
47
+ values.merge!(deserialized)
48
+ record.delete k
47
49
  end
48
50
  end
49
51
  end
52
+ record.merge!(values)
50
53
 
51
54
  if block_given?
52
55
  yield time, record
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-json-in-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin M. Roy