fluent-plugin-bunyan 0.0.3 → 0.0.4
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 +4 -4
- data/CHANGELOG.md +18 -1
- data/Gemfile.lock +1 -3
- data/README.md +1 -1
- data/azure-pipelines.yml +2 -2
- data/fluent-plugin-bunyan.gemspec +1 -1
- data/lib/fluent/plugin/parser_bunyan.rb +13 -7
- data/test/plugin/test_parser_bunyan.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c7ca077c27fc89eada5a3b8854ae9ac6b16a26503d73fa5690f4b8ed423d77c
|
4
|
+
data.tar.gz: 35fe59d48c1c8dabe0c22900ff203e46884fb0b21125e7a8799399b70f3a3fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4854c127c3a0903daa6b604f2b347c9bea23f9fe202fad1c10779b340efc177459cb34552f35a50c713f36241fd9e2204cd64bd7b55dcc75dd744cd5f876a86
|
7
|
+
data.tar.gz: 44b4796655c0985988e9683a71ce0a849c9cb4d45ad075267ff790f542bb7022c1c41b28690e47de42ac5c703a2a05b6dd6be69cb86102ee7e130c1d05bf4353
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
This file contains changes throughout the life of this project.
|
4
4
|
|
5
5
|
### Development
|
6
|
-
[Full Changelog](https://github.com/gildas/fluent-plugin-bunyan/compare/v0.0.
|
6
|
+
[Full Changelog](https://github.com/gildas/fluent-plugin-bunyan/compare/v0.0.4...dev)
|
7
7
|
|
8
8
|
New Features:
|
9
9
|
* None Yet
|
@@ -11,6 +11,23 @@ New Features:
|
|
11
11
|
Bug Fixes:
|
12
12
|
* None Yet
|
13
13
|
|
14
|
+
### 0.0.4 / 2020-03-17
|
15
|
+
[Full Changelog](https://github.com/gildas/fluent-plugin-bunyan/compare/v0.0.3...v0.0.4)
|
16
|
+
|
17
|
+
Bug Fixes:
|
18
|
+
* JSON logs were not extracted properly when coming from Kubernetes
|
19
|
+
|
20
|
+
### 0.0.3 / 2020-03-15
|
21
|
+
[Full Changelog](https://github.com/gildas/fluent-plugin-bunyan/compare/v0.0.2...v0.0.3)
|
22
|
+
|
23
|
+
New Features:
|
24
|
+
* Not exactly a feature, but tests go through Azure Pipeline
|
25
|
+
|
26
|
+
Bug Fixes:
|
27
|
+
* Removed the requirement of rake version as per gem build warning
|
28
|
+
* The Fluent parser was not "required" properly besides tests passing
|
29
|
+
* License was still Apache on the README file
|
30
|
+
|
14
31
|
### 0.0.2 / 2020-03-10
|
15
32
|
[Full Changelog](https://github.com/gildas/fluent-plugin-bunyan/compare/v0.0.1...v0.0.2)
|
16
33
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-bunyan (0.0.
|
4
|
+
fluent-plugin-bunyan (0.0.4)
|
5
5
|
fluentd (>= 0.14.10, < 2)
|
6
6
|
|
7
7
|
GEM
|
@@ -22,7 +22,6 @@ GEM
|
|
22
22
|
http_parser.rb (0.6.0)
|
23
23
|
msgpack (1.3.3)
|
24
24
|
power_assert (0.2.7)
|
25
|
-
rake (13.0.1)
|
26
25
|
serverengine (2.2.1)
|
27
26
|
sigdump (~> 0.2.2)
|
28
27
|
sigdump (0.2.4)
|
@@ -41,7 +40,6 @@ PLATFORMS
|
|
41
40
|
DEPENDENCIES
|
42
41
|
bundler (~> 1.14)
|
43
42
|
fluent-plugin-bunyan!
|
44
|
-
rake (>= 12.3.3)
|
45
43
|
test-unit (~> 3.0)
|
46
44
|
|
47
45
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Simply add the parser to the [Fluentd](https://fluentd.org/) configuration file,
|
|
34
34
|
To run the unit tests, make sure you have the [Fluentd](https://fluentd.org/) gem installed and run:
|
35
35
|
|
36
36
|
```console
|
37
|
-
|
37
|
+
rake test
|
38
38
|
```
|
39
39
|
|
40
40
|
## Copyright
|
data/azure-pipelines.yml
CHANGED
@@ -26,13 +26,19 @@ module Fluent
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def parse(text)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
# Example of a log line we want to get stuff from:
|
30
|
+
# 2020-03-16T22:14:05.710251038+09:00 stdout F {"UserAgent":"kube-probe/1.17","hostname":"helloworld-go-helloworld-5649dfd7bd-k8954","level":30,"msg":"request start: GET /","name":"helloworld","pid":1,"remote":"10.1.10.1:60114","reqid":"e4745ed6-82d4-4013-aeda-1d02bef42331","scope":"/","tid":17,"time":"2020-03-16T13:14:05Z","topic":"route","v":0}
|
31
|
+
if text =~ /[^{]*({.*)/
|
32
|
+
super(text.sub(/[^{]*({.*)/, '\1')) do |time, record|
|
33
|
+
if record then
|
34
|
+
record["severity"] = severity(record["level"] || 0)
|
35
|
+
record["host"] = record.delete("hostname")
|
36
|
+
record["message"] = record.delete("msg")
|
33
37
|
|
34
|
-
|
35
|
-
|
38
|
+
record.delete("v")
|
39
|
+
end
|
40
|
+
yield time, record
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
@@ -46,7 +52,7 @@ module Fluent
|
|
46
52
|
end
|
47
53
|
|
48
54
|
def version
|
49
|
-
return "0.0.
|
55
|
+
return "0.0.4"
|
50
56
|
end
|
51
57
|
end
|
52
58
|
end
|
@@ -81,6 +81,27 @@ class BunyanParserTest < Test::Unit::TestCase
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
test "can parse entry from Kubernetes" do
|
85
|
+
driver = create_driver(CONFIG)
|
86
|
+
text = '2020-03-10T07:08:41.710251038+09:00 stdout F {"hostname":"helloworld-go-helloworld-5649dfd7bd-k8954","level":30,"msg":"The message","name":"helloworld","pid":1,"scope":"main","tid":1,"time":"2020-03-10T07:08:41Z","topic":"main","v":0}'
|
87
|
+
expected_time = Time.utc(2020, 3, 10, 7, 8, 41).to_i
|
88
|
+
expected_record = {
|
89
|
+
"host" => "helloworld-go-helloworld-5649dfd7bd-k8954",
|
90
|
+
"name" => "helloworld",
|
91
|
+
"severity" => "info",
|
92
|
+
"level" => 30,
|
93
|
+
"message" => "The message",
|
94
|
+
"topic" => "main",
|
95
|
+
"scope" => "main",
|
96
|
+
"pid" => 1,
|
97
|
+
"tid" => 1,
|
98
|
+
}
|
99
|
+
driver.instance.parse(text) do |time, record|
|
100
|
+
assert_equal(expected_record, record)
|
101
|
+
assert_equal(expected_time, time)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
84
105
|
private
|
85
106
|
|
86
107
|
def create_driver(conf = CONFIG)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-bunyan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gildas Cherruel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|