fluent-plugin-text_to_json 0.1.23 → 0.1.24

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: 31650e7675ee248a532af96d14681937e5b8d080
4
- data.tar.gz: db5819f75feff82e18a6b6859836594e3a573ed2
3
+ metadata.gz: 09253e284b5f1461d6a8448b2a66f483ebce7647
4
+ data.tar.gz: c52fb58fc5df68d4aaffc66c5a344638fc281a0c
5
5
  SHA512:
6
- metadata.gz: 08f98a63c8a70fcd8d1389b54d1db7be8e889a9d616a69d3b38f0db7fac110521b8ae497c393aa5465e5e6779620cff679f6e684fd695b6379e62fcc0cfa217e
7
- data.tar.gz: 3e889453e54c724260c81ba1611bc43f36e10dbf93a9c3b01a68ebb781aef69ffae2bbd5b474d23bf575367612db10646ab3030c6623ae26f539973f1dffd28b
6
+ metadata.gz: 5cb170033a134e72c2ee640fa8a45d28277ef422db1bd541f4770ee8c3fb27c74f9cc78696f1a44dd61a154307ece172323d6357b930336c8a7abd4cda817b94
7
+ data.tar.gz: 934b84b8100ac8735dc6cb7b6d8422eae03ec622e43c88c391f53e7b8735670ffbad5887cf1522b799de6d9ddb0b3de860036ef22d532e7cea96076157ccc74f
@@ -15,43 +15,41 @@ module Fluent
15
15
  end
16
16
 
17
17
  def format(tag, time, record)
18
- test = record.values
19
- test = test.join("")
20
- "#{test}\n"
21
- #tmp_field = record.split(@field_splitter)
22
- #
23
- #tmp_field[1] = @field_splitter + tmp_field[1]
24
- #
25
-
26
- ##sdr parameters to json format
27
- #tmp_field[0] = tmp_field[0].split("\n")
28
- #tmp_field[0] = tmp_field[0].map{|value| (value == "")? nil:value} # HBase plugin ignores nil values
29
- #tmp_field[0] = tmp_field[0].map{|value| (value == nil)? nil:"\""+value+"\""}
30
- #
31
- #tmp_field[0] = @fields[2,14].zip(tmp_field[0])
32
- #tmp_field[0] = tmp_field[0].map{|x| x.join(":")}.join(",")
33
- #tmp_field[0] = @field[0] + ":" + "{" + tmp_field[0] + "}"
34
- #
35
-
36
- ##factor paramters to json format
37
- #tmp_field[1] = tmp_field[1].split("\n")
38
- ##Set factor ID as a second field's name
39
- #head, *tail = tmp_field[1].split("\n")
40
- #haed = head.split("|")
41
- #head = head.map{|field| "\""+field+"\""}
42
-
43
-
44
- #tail = tail.map{|values| values.split("|")}
45
-
46
- #new_tail = Array.new(head.length)
47
- #
48
- #for i in 0..head.length-1
49
- #new_tail[i] = "\"" + tail.map{|values| values[i]}.join(",") + "\""
50
- #end
18
+
19
+ tmp_field = record.values.join("").split(@field_splitter)
20
+
21
+ tmp_field[1] = @field_splitter + tmp_field[1]
22
+
23
+
24
+ #sdr parameters to json format
25
+ tmp_field[0] = tmp_field[0].split("\n")
26
+ tmp_field[0] = tmp_field[0].map{|value| (value == "")? nil:value} # HBase plugin ignores nil values
27
+ tmp_field[0] = tmp_field[0].map{|value| (value == nil)? nil:"\""+value+"\""}
28
+
29
+ tmp_field[0] = @fields[2,14].zip(tmp_field[0])
30
+ tmp_field[0] = tmp_field[0].map{|x| x.join(":")}.join(",")
31
+ tmp_field[0] = @field[0] + ":" + "{" + tmp_field[0] + "}"
32
+
33
+
34
+ #factor paramters to json format
35
+ tmp_field[1] = tmp_field[1].split("\n")
36
+ #Set factor ID as a second field's name
37
+ head, *tail = tmp_field[1].split("\n")
38
+ haed = head.split("|")
39
+ head = head.map{|field| "\""+field+"\""}
40
+
41
+
42
+ tail = tail.map{|values| values.split("|")}
43
+
44
+ new_tail = Array.new(head.length)
45
+
46
+ for i in 0..head.length-1
47
+ new_tail[i] = "\"" + tail.map{|values| values[i]}.join(",") + "\""
48
+ end
51
49
 
52
- #tmp_field[1] = "{" + head.zip(new_tail).map{|field,value| field + ":" + value }.join(",") + "}"
53
- #
54
- #"{" + @fileds[0] + ":" + "{" + tmp_field[0] + "}," + @fields[1] + ":" + "{" + tmp_field[1] + "}}"
50
+ tmp_field[1] = "{" + head.zip(new_tail).map{|field,value| field + ":" + value }.join(",") + "}"
51
+
52
+ "{" + @fileds[0] + ":" + "{" + tmp_field[0] + "}," + @fields[1] + ":" + "{" + tmp_field[1] + "}}"
55
53
 
56
54
 
57
55
  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.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - minwoo lee