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 +4 -4
- data/README.md +1 -1
- data/fluent-plugin-json-in-json.gemspec +1 -1
- data/lib/fluent/plugin/parser_json_in_json.rb +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3789a3629e0e671eb764ab5595d8413b5f81cd94
|
4
|
+
data.tar.gz: 61dabe27f92345bd68d63f35d1a21073846be1ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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\"}"}
|
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.
|
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] == '{'
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|