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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1029080cec5f0f3c41daf53690064ede240203a0c4f8aef2f2efe3a6e3f494ab
4
- data.tar.gz: f08f8da72daebe1551b142b5518dc61236ee805b1b297b76d662ead4a844cd8a
3
+ metadata.gz: 9c7ca077c27fc89eada5a3b8854ae9ac6b16a26503d73fa5690f4b8ed423d77c
4
+ data.tar.gz: 35fe59d48c1c8dabe0c22900ff203e46884fb0b21125e7a8799399b70f3a3fe8
5
5
  SHA512:
6
- metadata.gz: 6da8a9d3af22e4fe0356d8bc2245970e9484d0d593cf005ea905d1cd9542dc33d2529c38c812733fd50fb7f8a0a0fba155a922e65e2cfb26d7142107595aafb4
7
- data.tar.gz: bda8cdada387de5bf07b4eb1d74c6aaf6aaf3447c3080a0dc84ad1592a3f517a76917b7b63c65fe117371fd1a4160d2c72f50078c0492ab9244bbba198de8ff0
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.2...dev)
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.2)
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
- bundle exec rake test
37
+ rake test
38
38
  ```
39
39
 
40
40
  ## Copyright
data/azure-pipelines.yml CHANGED
@@ -20,5 +20,5 @@ steps:
20
20
  bundle install --retry=3 --jobs=4
21
21
  displayName: 'bundle install'
22
22
 
23
- - script: bundle exec rake
24
- displayName: 'bundle exec rake'
23
+ - script: rake test
24
+ displayName: 'run tests'
@@ -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-bunyan"
6
- spec.version = "0.0.3"
6
+ spec.version = "0.0.4"
7
7
  spec.authors = ["Gildas Cherruel"]
8
8
  spec.email = ["gildas@breizh.org"]
9
9
 
@@ -26,13 +26,19 @@ module Fluent
26
26
  end
27
27
 
28
28
  def parse(text)
29
- super(text) do |time, record|
30
- record["severity"] = severity(record["level"] || 0)
31
- record["host"] = record.delete("hostname")
32
- record["message"] = record.delete("msg")
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
- record.delete("v")
35
- yield time, record
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.3"
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.3
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-15 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler