fluent-plugin-kubernetes_metadata_filter 0.31.0 → 0.32.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 989125c79b1bd4fa6f72d872f11d0fd439e18a0c
|
4
|
+
data.tar.gz: 624665a54645b53019d3e328ec9a37f5c68472d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37a5dac8e9f2b76f30c610d9636559e026820ba2ca75e2c8e4c640237c3b5e72c1cde67ca4692d5b19763362b1b56c5f63af0a4e664316c7f28401faf80ab28d
|
7
|
+
data.tar.gz: 998b7939864d1ef76898511f5c8656d3f84695a2e804ca7fbb5738e5404dcbe5f74db22b44473e36fa26cdc41dfdc41d5d1c2c27f021cf0438473ee271fe8be8
|
data/README.md
CHANGED
@@ -25,11 +25,13 @@ This must used named capture groups for `container_name`, `pod_name` & `namespac
|
|
25
25
|
* `watch` - set up a watch on pods on the API server for updates to metadata (default: `true`)
|
26
26
|
* `merge_json_log` - merge logs in JSON format as top level keys (default: `true`)
|
27
27
|
* `preserve_json_log` - preserve JSON logs in raw form in the `log` key, only used if the previous option is true (default: `true`)
|
28
|
-
* `de_dot` - replace dots in labels with configured `de_dot_separator`, required for ElasticSearch 2.x compatibility (default: `true`)
|
28
|
+
* `de_dot` - replace dots in labels and annotations with configured `de_dot_separator`, required for ElasticSearch 2.x compatibility (default: `true`)
|
29
29
|
* `de_dot_separator` - separator to use if `de_dot` is enabled (default: `_`)
|
30
30
|
* `use_journal` - If false (default), messages are expected to be formatted and tagged as if read by the fluentd in\_tail plugin with wildcard filename. If true, messages are expected to be formatted as if read from the systemd journal. The `MESSAGE` field has the full message. The `CONTAINER_NAME` field has the encoded k8s metadata (see below). The `CONTAINER_ID_FULL` field has the full container uuid. This requires docker to use the `--log-driver=journald` log driver.
|
31
31
|
* `container_name_to_kubernetes_regexp` - The regular expression used to extract the k8s metadata encoded in the journal `CONTAINER_NAME` field (default: `'^(?<name_prefix>[^_]+)_(?<container_name>[^\._]+)(\.(?<container_hash>[^_]+))?_(?<pod_name>[^_]+)_(?<namespace>[^_]+)_[^_]+_[^_]+$'`
|
32
32
|
* This corresponds to the definition [in the source](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/dockertools/docker.go#L317)
|
33
|
+
* `include_namespace_metadata` - Collect metadata about namespace such as uid, labels and annotations (default: `false`).
|
34
|
+
Note that when this option is enabled, all label from namespace are collected, but annotations are collected according to `annotation_match` value. If `annotation_match` is not presented, no annotations will be collected from the namespace.
|
33
35
|
* `annotation_match` - Array of regular expressions matching annotation field names. Matched annotations are added to a log record.
|
34
36
|
|
35
37
|
Reading from the JSON formatted log files with `in_tail` and wildcard filenames:
|
@@ -110,6 +112,12 @@ Then output becomes as belows
|
|
110
112
|
"container_name": "fabric8-console-container",
|
111
113
|
"namespace_name": "default",
|
112
114
|
"namespace_id": "23437884-8e08-4d95-850b-e94378c9b2fd",
|
115
|
+
"namespace_annotations": {
|
116
|
+
"fabric8.io/git-commit": "5e1116f63df0bac2a80bdae2ebdc563577bbdf3c"
|
117
|
+
},
|
118
|
+
"namespace_labels": {
|
119
|
+
"product_version": "v1.0.0"
|
120
|
+
},
|
113
121
|
"labels": {
|
114
122
|
"component": "fabric8Console"
|
115
123
|
}
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "fluent-plugin-kubernetes_metadata_filter"
|
7
|
-
gem.version = "0.
|
7
|
+
gem.version = "0.32.0"
|
8
8
|
gem.authors = ["Jimmi Dyson"]
|
9
9
|
gem.email = ["jimmidyson@gmail.com"]
|
10
10
|
gem.description = %q{Filter plugin to add Kubernetes metadata}
|
@@ -137,7 +137,7 @@ module Fluent
|
|
137
137
|
return if @curr_time.to_i - @prev_time.to_i < @stats_interval
|
138
138
|
@prev_time = @curr_time
|
139
139
|
@stats.set(:pod_cache_size, @cache.count)
|
140
|
-
@stats.set(:namespace_cache_size, @namespace_cache.count)
|
140
|
+
@stats.set(:namespace_cache_size, @namespace_cache.count) if @namespace_cache
|
141
141
|
log.info(@stats)
|
142
142
|
end
|
143
143
|
|
@@ -34,6 +34,22 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
|
|
34
34
|
Test::FilterTestDriver.new(KubernetesMetadataFilter, 'var.log.containers.fabric8-console-controller-98rqc_default_fabric8-console-container-49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459.log').configure(conf, true)
|
35
35
|
end
|
36
36
|
|
37
|
+
sub_test_case 'dump_stats' do
|
38
|
+
|
39
|
+
test 'dump stats with indclude_namespace_metadata' do
|
40
|
+
VCR.use_cassette('kubernetes_docker_metadata') do
|
41
|
+
d = create_driver('
|
42
|
+
kubernetes_url https://localhost:8443
|
43
|
+
watch false
|
44
|
+
cache_size 1
|
45
|
+
include_namespace_metadata false
|
46
|
+
stats_interval 0
|
47
|
+
')
|
48
|
+
d.instance.dump_stats
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
37
53
|
sub_test_case 'configure' do
|
38
54
|
test 'check default' do
|
39
55
|
d = create_driver
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-kubernetes_metadata_filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmi Dyson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|