fluent-plugin-json-in-json 0.1.1 → 0.1.2

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: 1f1aad697ed594bcb1556ae258ad2e7f44fc5296
4
- data.tar.gz: 8e8a0a7cafe108221b0aaf0c09236ce0bfc71da8
3
+ metadata.gz: 516f10d88898ff297402ec12ce5fcd3194e19851
4
+ data.tar.gz: 04a51da2be344471238e10065d6fbb5bf261ba97
5
5
  SHA512:
6
- metadata.gz: 51479eb81a3a15419223ab0a6396e9544a22bb224eed82608d6dea35cfb43f84fbb61e109606c30b6781ceff99305ebaddf8ae4050ce9419e067d72fb8a29376
7
- data.tar.gz: 38d748b629dd0ae0ee5a93151ef14e7c61db581ac143d180806b3638e9787e96ab5351004328afd14e2c8978497b046eba79ba989e1cdd69f20a54bbe00b728a
6
+ metadata.gz: 84010a6713575b8a24ad19ed8499e36d77334bd4eecf435121b25e75575926e5fac08f793671d99c152d93d4372d01e360f705ddaa69949490efbe959988656e
7
+ data.tar.gz: 6793e3a089f3ec0c936d8290eac34ec82d22400aa6918202d899490db72c155c589f87fe21fa0914bf5e35f08f713be4a975084fdff4b8ff322c9a98be3f8138
@@ -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.1"
4
+ spec.version = "0.1.2"
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}
@@ -2,15 +2,23 @@ require 'yajl'
2
2
 
3
3
  module Fluent
4
4
  class TextParser
5
- class JSONInJSONParser < JSONParser
5
+ class JSONInJSONParser < Parser
6
6
  Fluent::Plugin.register_parser('json_in_json', self)
7
7
 
8
- def parse(text)
9
- record = Yajl.load(text)
8
+ config_param :time_key, :string, :default => 'time'
9
+ config_param :time_format, :string, :default => nil
10
10
 
11
- record.each do |key, value|
12
- record[key] = Yajl.load(value)
11
+ def configure(conf)
12
+ super
13
+
14
+ unless @time_format.nil?
15
+ @time_parser = TimeParser.new(@time_format)
16
+ @mutex = Mutex.new
13
17
  end
18
+ end
19
+
20
+ def parse(text)
21
+ record = Yajl.load(text)
14
22
 
15
23
  value = @keep_time_key ? record[@time_key] : record.delete(@time_key)
16
24
  if value
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin M. Roy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-18 00:00:00.000000000 Z
11
+ date: 2015-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yajl-ruby