fluent-plugin-serialize-nested-json 0.0.1 → 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.
- checksums.yaml +4 -4
- data/README.md +12 -15
- data/fluent-plugin-serialize-nested-json.gemspec +1 -1
- data/lib/fluent/plugin/parser_serialize_nested_json.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08d2df2a249446b73c92e38f242a9a524f22be9d'
|
4
|
+
data.tar.gz: 88ef0de90c736019e5ef12a3bf92689cfb3e0964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbfe61447bce14b4fce3193bdf00c625273023fd70701016b2166e48acc0bcd604dcc40b1fab2f887f4cb7b0d87ac9082e7535aad238f75ce583a7f80935489
|
7
|
+
data.tar.gz: ec37576994a044d546b661922c974a92ac1a61b0f21f42deb1f04b01f05c5ae526171b08a747e1c1634cf64c30f9fae06634c1163ac86bdf54ebc89391d1a6d1
|
data/README.md
CHANGED
@@ -1,20 +1,17 @@
|
|
1
|
-
# fluent-plugin-
|
1
|
+
# fluent-plugin-serialize-nested-json
|
2
|
+
[](https://badge.fury.io/rb/fluent-plugin-serialize-nested-json)
|
2
3
|
|
3
|
-
This
|
4
|
+
This fluentd parser plugin serializes nested JSON objects in JSON log lines, basically it exactly
|
5
|
+
does reverse of [fluent-plugin-json-in-json](https://github.com/alikhil/fluent-plugin-json-in-json).
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
## Requirements
|
8
|
-
|
9
|
-
This fluentd parser plugin parses JSON log lines with nested JSON strings. For
|
10
|
-
example, given a docker log of ``{"log": "{\"foo\": \"bar\"}"}``, the log record
|
11
|
-
will be parsed into ``{:log => { :foo => "bar" }}``.
|
7
|
+
For example,
|
8
|
+
``{"ref": {"foo": "bar"}}``, the log record will be parsed into ``{:ref => "{\"foo\": \"bar\"}"}``.
|
12
9
|
|
13
10
|
## Installation
|
14
11
|
|
15
12
|
Add this line to your application's Gemfile:
|
16
13
|
|
17
|
-
gem 'fluent-plugin-
|
14
|
+
gem 'fluent-plugin-serialize-nested-json'
|
18
15
|
|
19
16
|
And then execute:
|
20
17
|
|
@@ -22,7 +19,7 @@ And then execute:
|
|
22
19
|
|
23
20
|
Or install it yourself as:
|
24
21
|
|
25
|
-
$ gem install fluent-plugin-
|
22
|
+
$ gem install fluent-plugin-serialize-nested-json
|
26
23
|
|
27
24
|
|
28
25
|
## Usage
|
@@ -30,11 +27,11 @@ Or install it yourself as:
|
|
30
27
|
```
|
31
28
|
<source>
|
32
29
|
type tail
|
33
|
-
path /var/
|
34
|
-
pos_file /var/log/fluentd
|
30
|
+
path /var/log/app/*.json
|
31
|
+
pos_file /var/log/fluentd.pos
|
35
32
|
time_format %Y-%m-%dT%H:%M:%S
|
36
|
-
tag
|
37
|
-
format
|
33
|
+
tag fluent.*
|
34
|
+
format serialize_nested_json
|
38
35
|
read_from_head true
|
39
36
|
</source>
|
40
37
|
```
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "fluent-plugin-serialize-nested-json"
|
4
|
-
spec.version = "0.0.
|
4
|
+
spec.version = "0.0.3"
|
5
5
|
spec.authors = ["Yagnesh Mistry"]
|
6
6
|
spec.email = ["ysh@live.in"]
|
7
7
|
spec.description = %q{Parser plugin that serializes nested JSON attributes}
|
@@ -6,6 +6,7 @@ module Fluent
|
|
6
6
|
class SerializeJSONParser < Parser
|
7
7
|
Plugin.register_parser('serialize_nested_json', self)
|
8
8
|
|
9
|
+
config_param :stringify_num, :bool, default: "false" # strinfify_num is configurable with "false" as default
|
9
10
|
config_set_default :time_key, 'time'
|
10
11
|
config_set_default :time_type, :float
|
11
12
|
|
@@ -31,6 +32,13 @@ module Fluent
|
|
31
32
|
# continue
|
32
33
|
end
|
33
34
|
end
|
35
|
+
if v.is_a?(Numeric) && @strinfify_num == true
|
36
|
+
begin
|
37
|
+
values[k] = v.to_s
|
38
|
+
record.delete k
|
39
|
+
rescue Exception => e
|
40
|
+
end
|
41
|
+
end
|
34
42
|
end
|
35
43
|
record.merge!(values)
|
36
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-serialize-nested-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yagnesh Mistry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.5.2.
|
138
|
+
rubygems_version: 2.5.2.3
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Parser plugin that serializes nested JSON attributes
|