fluent-plugin-barito 0.2.1 → 0.2.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
- SHA1:
3
- metadata.gz: 3b8b4d0a6c8a306822d554c28e797afb834f7353
4
- data.tar.gz: efe60aa26d3d516599e1169cdb635aa9c827860d
2
+ SHA256:
3
+ metadata.gz: ea66818ca2cbcab4339ee69b8e4b7df8196ec94f39fafff1ea79bb17a5d80faa
4
+ data.tar.gz: a7fcfe47fbae888db2aa54813730fb77eee806f0e38b7ded56eaaec9c8e3f1d0
5
5
  SHA512:
6
- metadata.gz: f30f33599986f9817db0ef5895ef9974f0d8e7b6f0db64c37de22ad921edd81783fce88ecc44e2a2f3763f8b9af2b2388414dc49e0ff53e7e328c739740febf3
7
- data.tar.gz: 57cc5ec0a223b87fa13c6dcc01d21362058d748dd17224b45af0508a2db9c564ff4ad52c8cad638a3765b19257e24dcb2d9035ce3e040b97d84bee768b105daa
6
+ metadata.gz: a05219378ff836fd4afc7ee5533c3c3d97dd0ecf8f60f1d6ff383859503aa87e622efaa8dddc1430004ef001584a9fd39938a56bd4c3d0a14b24eb79741bc3f8
7
+ data.tar.gz: 5687a35a0b334de920652b2a01b68019d177fcc9cf782fc0aac72933f6f105c6dce873d6c603425d2e69d993fab1bef1faeb05360e51329ae032be2b18038a3d
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-barito"
6
- spec.version = "0.2.1"
6
+ spec.version = "0.2.2"
7
7
  spec.authors = ["BaritoLog"]
8
8
  spec.email = ["pushm0v.development@gmail.com", "iman.tung@gmail.com"]
9
9
 
@@ -6,7 +6,7 @@ class Fluent::Plugin::TimberFactory
6
6
 
7
7
  def self.create_timber(tag, time, record, trail)
8
8
  begin
9
- timber = JSON.parse(record['message'])
9
+ timber = JSON.parse(record[MESSAGE_KEY])
10
10
  rescue
11
11
  end
12
12
 
@@ -22,6 +22,15 @@ class Fluent::Plugin::TimberFactory
22
22
  if message.nil? or message.empty?
23
23
  message = record.to_s
24
24
  trail.hints << HINTS_NO_MESSAGE
25
+ else
26
+ new_message = nil
27
+ begin
28
+ new_message = JSON.parse(message)
29
+ rescue
30
+ end
31
+ if not new_message.nil? and new_message.is_a?(Hash)
32
+ message = new_message
33
+ end
25
34
  end
26
35
 
27
36
  timber['tag'] = tag
@@ -55,10 +55,11 @@ describe 'Fluent::BaritoK8sOutput' do
55
55
  it do
56
56
  out = Fluent::BaritoK8sOutput.new
57
57
 
58
- record = { "log" => "{\"some_attr\":\"info\"}", "other_attr" => "other_value"}
58
+ record = { "log" => "{\"some_attr\":\"info\",\"nested\":{\"nested_attr\":\"nested_value\"}}", "other_attr" => "other_value"}
59
59
  new_record = out.merge_log_attribute(record)
60
60
 
61
61
  expect(new_record['some_attr']).to eq("info")
62
+ expect(new_record['nested']['nested_attr']).to eq("nested_value")
62
63
  expect(new_record['other_attr']).to eq("other_value")
63
64
  end
64
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-barito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - BaritoLog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-22 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.6.13
190
+ rubygems_version: 2.7.6
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Fluentd output plugin for BaritoLog