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 +4 -4
- data/fluent-plugin-kubernetes.gemspec +1 -1
- data/lib/fluent/plugin/out_kubernetes.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9077f299db0493efda09f44151f89239a6e1ae4e
|
4
|
+
data.tar.gz: 2e3264f349f3ba041be43eb39c66e739d630d994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|