fluent-plugin-text_to_json 0.1.55 → 0.1.56

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c9de52a453ded90154c36d6265109c03c9403b8
4
- data.tar.gz: 93746664bd09d8746cc4c3b7ac1274b21668a7e8
3
+ metadata.gz: 882de2dbd43f38c83e0ab39e63184491d01ea6fa
4
+ data.tar.gz: 2a02dab2c2f232518a28deeee6079839901fb873
5
5
  SHA512:
6
- metadata.gz: 24ed35f08237283216bd6648a3646bca9b8210afeec584c30ac444ddcc5f33e453d052b0f86d8aa25b45bce1d0451009c15b81c7e3da6b2414b254f5c9bacda4
7
- data.tar.gz: 87b3feb17bff033ad70f0b44a98a53e3bc1b704c7adfcd7ab7fef8f1bb7e478b0451f2437cdc7f77737d461c492b1aec5f707f4530c8156e666f16c775f7e38b
6
+ metadata.gz: 595a568e6b954d37ec4a1ef28068f30dc18c86b756fc944ca88dcffea2e89cb685d12e2a6c591dd401a949ae297f71679f4453d3446e4d7b80efa34e6d77b2b6
7
+ data.tar.gz: 187d0f97791c8f3a29bfc355f83f1ed5ab767bf19b671f6190e8aaf64eff5a477f89608fbc2c37252cb64afd2e0232cd94bb8abe771d40efe8688d9985b7a884
@@ -1,18 +1,17 @@
1
1
  require 'fluent/formatter'
2
+ require 'json'
2
3
 
3
4
 
4
5
  module Fluent
5
6
  module TextFormatter
6
7
  class TextToJsonFormatter < Formatter
7
8
  Fluent::Plugin.register_formatter('text_to_json', self)
8
- helpers :formatter
9
9
  config_param :json_field, :string, :default => "sdr,factor,1,2,3,4,5,6,7,8,9,10,11,12,13"
10
10
  config_param :field_splitter, :string, :default => "A000"
11
11
 
12
12
  def configure(conf)
13
13
  super
14
14
  @fields = @json_field.split(",").map{|field| "\"" + field + "\""}
15
- @formatter = formatter_create(type: 'json')
16
15
  end
17
16
 
18
17
  def format(tag, time, record)
@@ -51,8 +50,7 @@ module Fluent
51
50
  tmp_field[1] = head.zip(new_tail).map{|field,value| field + ":" + value }.join(",")
52
51
 
53
52
  out_string = "{#{@fields[0]}:{#{tmp_field[0]}},#{@fields[1]}:{#{tmp_field[1]}}}"
54
- @formatter.format(tag, time, out_string)
55
-
53
+ JSON.parse(out_string)
56
54
 
57
55
  end
58
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-text_to_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.55
4
+ version: 0.1.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - minwoo lee