fluent-plugin-kubernetes 0.2.4 → 0.3.0

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: 977db5600fafdcff8cc82606036408940b95adff
4
- data.tar.gz: c5804c21735acc1b7db7f61439ae5023cdc73263
3
+ metadata.gz: 9077f299db0493efda09f44151f89239a6e1ae4e
4
+ data.tar.gz: 2e3264f349f3ba041be43eb39c66e739d630d994
5
5
  SHA512:
6
- metadata.gz: 049347cca975757903ad2838a7a976f062c5e9e8fce3bf91d73beaeb52f1bc961ab746b475ea8d8966551fba24392e228e71508ad48c78bb892c27f33bfb56df
7
- data.tar.gz: 461d42695b518c427c15918c7e4381892a9fb8e13ada9fcd5ee230a862a161b21a2fb1c52e1f9b1e001cb453a4056357c11f08ca5b9d6607fa1f96a12e8f0ec8
6
+ metadata.gz: a3dab5944d7eececb8ca54dd9958efc39761033e68386aa96c2430d80af9656be1a2ffd046da809a623c3270979ad69024568bdb8a6fe45797b77776ef62ac92
7
+ data.tar.gz: 40385e50cb28ba086abd61158eb92f7ae39d65bb58cf5f888bd4e45e942c6d1c2b057b198c4cc06fd55e510c32834d36197419a16397ab5b8fd509d09ab66d4d
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "fluent-plugin-kubernetes"
8
- spec.version = "0.2.4"
8
+ spec.version = "0.3.0"
9
9
  spec.authors = ["Jimmi Dyson"]
10
10
  spec.email = ["jimmidyson@gmail.com"]
11
11
  spec.description = %q{Output filter plugin to add Kubernetes metadata}
@@ -33,6 +33,7 @@ class Fluent::KubernetesOutput < Fluent::Output
33
33
  super
34
34
 
35
35
  require 'docker'
36
+ require 'json'
36
37
  end
37
38
 
38
39
  def emit(tag, es, chain)
@@ -55,6 +56,17 @@ class Fluent::KubernetesOutput < Fluent::Output
55
56
 
56
57
  def enrich_record(tag, record)
57
58
  if @container_id
59
+ log = record['log'].strip
60
+ if log[0].eql?('{') && log[-1].eql?('}')
61
+ begin
62
+ parsed_log = JSON.parse(log)
63
+ record = record.merge(parsed_log)
64
+ unless parsed_log.has_key?('log')
65
+ record.delete('log')
66
+ end
67
+ rescue JSON::ParserError
68
+ end
69
+ end
58
70
  id = interpolate(tag, @container_id)
59
71
  record['container_id'] = id
60
72
  container = Docker::Container.get(id)
@@ -77,4 +89,4 @@ class Fluent::KubernetesOutput < Fluent::Output
77
89
  record
78
90
  end
79
91
 
80
- end
92
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kubernetes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmi Dyson