fluent-plugin-barito 0.1.8 → 0.1.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a929ac745d1147fe4f117dbf6c6bd6e57bd62a0b
|
4
|
+
data.tar.gz: 9d2d374bc1f6ffd61cd5a8eb596a7c7b1e4088bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccc8400bef024b7de718fc3bd726578f582a22eb68f5cd2b81a6a06fceef6cb6af1925b8b1d828eb7da8d17fe54106580c26364efa1e6fdb79820e4a9006e143
|
7
|
+
data.tar.gz: 68f14b651871dbe6bb9065e656bb7435a4c0f1992eba6c68ff655c689e158b0fd84cb8d419f7a9934dee44c1077a1b14ef746156e3411ba184396172345fbb11
|
@@ -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.1.
|
6
|
+
spec.version = "0.1.9"
|
7
7
|
spec.authors = ["BaritoLog"]
|
8
8
|
spec.email = ["pushm0v.development@gmail.com", "iman.tung@gmail.com"]
|
9
9
|
|
@@ -5,35 +5,30 @@ class Fluent::Plugin::TimberFactory
|
|
5
5
|
HINTS_NO_MESSAGE = "no #{MESSAGE_KEY}".freeze
|
6
6
|
|
7
7
|
def self.create_timber(tag, time, record, trail)
|
8
|
-
|
9
8
|
begin
|
10
|
-
timber = JSON.parse(record
|
9
|
+
timber = JSON.parse(record)
|
11
10
|
rescue
|
12
11
|
end
|
13
12
|
|
14
13
|
unless timber.is_a?(Hash) then
|
15
14
|
timber = Hash.new
|
16
15
|
end
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
# Capture default information
|
19
18
|
message = record[MESSAGE_KEY] if record.is_a?(Hash) and record.has_key?(MESSAGE_KEY)
|
20
19
|
client_trail = trail
|
21
|
-
|
22
|
-
|
23
20
|
timestamp = Time.now.utc.strftime('%FT%TZ')
|
24
|
-
|
25
|
-
|
21
|
+
|
26
22
|
if message.nil? or message.empty?
|
27
23
|
message = record.to_s
|
28
24
|
trail.hints << HINTS_NO_MESSAGE
|
29
25
|
end
|
30
|
-
|
26
|
+
|
31
27
|
timber['tag'] = tag
|
32
28
|
timber['@message'] = message
|
33
29
|
timber['@timestamp'] = timestamp
|
34
30
|
timber['client_trail'] = client_trail.to_hash
|
35
|
-
|
36
|
-
timber
|
37
|
-
|
31
|
+
|
32
|
+
timber
|
38
33
|
end
|
39
34
|
end
|
@@ -9,7 +9,7 @@ describe 'Fluent::Plugin::TimberFactory' do
|
|
9
9
|
it 'is json' do
|
10
10
|
trail = Fluent::Plugin::ClientTrail.new(true)
|
11
11
|
tag = "some_tag"
|
12
|
-
record =
|
12
|
+
record = '{"booking_id":1234, "foo":"bar"}'
|
13
13
|
|
14
14
|
timber = Fluent::Plugin::TimberFactory::create_timber(tag, nil, record, trail)
|
15
15
|
expect(timber['booking_id']).to eq(1234)
|
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.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BaritoLog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|