fluent-plugin-kubernetes_metadata_filter 2.5.2 → 2.11.1
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/.circleci/config.yml +10 -14
- data/.rubocop.yml +57 -0
- data/Gemfile +4 -2
- data/Gemfile.lock +62 -60
- data/README.md +10 -37
- data/Rakefile +15 -11
- data/fluent-plugin-kubernetes_metadata_filter.gemspec +25 -27
- data/lib/fluent/plugin/filter_kubernetes_metadata.rb +178 -137
- data/lib/fluent/plugin/kubernetes_metadata_cache_strategy.rb +23 -21
- data/lib/fluent/plugin/kubernetes_metadata_common.rb +51 -67
- data/lib/fluent/plugin/kubernetes_metadata_stats.rb +6 -6
- data/lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb +68 -0
- data/lib/fluent/plugin/kubernetes_metadata_util.rb +53 -0
- data/lib/fluent/plugin/kubernetes_metadata_watch_namespaces.rb +91 -53
- data/lib/fluent/plugin/kubernetes_metadata_watch_pods.rb +109 -60
- data/release_notes.md +42 -0
- data/test/cassettes/kubernetes_get_pod_container_init.yml +145 -0
- data/test/helper.rb +20 -2
- data/test/plugin/test_cache_stats.rb +10 -13
- data/test/plugin/test_cache_strategy.rb +158 -160
- data/test/plugin/test_filter_kubernetes_metadata.rb +464 -360
- data/test/plugin/test_utils.rb +56 -0
- data/test/plugin/test_watch_namespaces.rb +181 -158
- data/test/plugin/test_watch_pods.rb +275 -235
- data/test/plugin/watch_test.rb +16 -15
- metadata +60 -67
- /data/test/cassettes/{kubernetes_docker_metadata_dotted_labels.yml → kubernetes_docker_metadata_dotted_slashed_labels.yml} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ed17c405e64607d3fee4b581345f32388a7b1f52db9633d83e6863f6da5358
|
4
|
+
data.tar.gz: e5d6002813b1ffb266b43eda059a2f7a6b050bb69162b52a48cf68e5bf116e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39196e160ffbf56e328f1b4baf2ce61cafbb3152e1c1bfc109a445a78083ed4bd25f28f81356472dffb975a2905cd90ef951f33ba1777572e1b3c86810323cd
|
7
|
+
data.tar.gz: 99377e8dbf5b6f95259b02ea923d22c1195fb582ac89ede2734fe29200305543e6916113ee49ec7c1fe6a4a839882038925925c724d662d27b5ef34f7bdeaf9e
|
data/.circleci/config.yml
CHANGED
@@ -4,7 +4,8 @@ install: &install
|
|
4
4
|
name: Install bundle
|
5
5
|
command: |
|
6
6
|
gem install bundler
|
7
|
-
bundle
|
7
|
+
bundle config set --local path vendor/bundle
|
8
|
+
bundle install
|
8
9
|
|
9
10
|
missingdeps: &missingdeps
|
10
11
|
name: Install missing dependecies
|
@@ -12,23 +13,20 @@ missingdeps: &missingdeps
|
|
12
13
|
cat /etc/os-release
|
13
14
|
printf "deb http://deb.debian.org/debian buster main\ndeb http://security.debian.org buster/updates main\ndeb-src http://security.debian.org buster/updates main" > /tmp/sources.list
|
14
15
|
sudo cp /tmp/sources.list /etc/apt/sources.list
|
15
|
-
sudo apt-get update
|
16
|
+
sudo apt-get --allow-releaseinfo-change update
|
16
17
|
sudo apt-get install cmake libicu-dev libssl-dev
|
17
|
-
|
18
|
+
|
18
19
|
test: &test
|
19
20
|
name: Test bundle
|
20
|
-
command: bundle exec rake test
|
21
|
+
command: bundle exec rake test --trace
|
21
22
|
|
22
23
|
executors:
|
23
|
-
ruby-2-4:
|
24
|
-
docker:
|
25
|
-
- image: circleci/ruby:2.4.6
|
26
|
-
ruby-2-5:
|
27
|
-
docker:
|
28
|
-
- image: circleci/ruby:2.5.5
|
29
24
|
ruby-2-6:
|
30
25
|
docker:
|
31
26
|
- image: circleci/ruby:2.6.3
|
27
|
+
ruby-2-7:
|
28
|
+
docker:
|
29
|
+
- image: circleci/ruby:2.7.1
|
32
30
|
jobs:
|
33
31
|
"ruby-test":
|
34
32
|
parameters:
|
@@ -49,9 +47,7 @@ jobs:
|
|
49
47
|
workflows:
|
50
48
|
"test_multiple_ruby_versions":
|
51
49
|
jobs:
|
52
|
-
- ruby-test:
|
53
|
-
ruby-version: ruby-2-4
|
54
|
-
- ruby-test:
|
55
|
-
ruby-version: ruby-2-5
|
56
50
|
- ruby-test:
|
57
51
|
ruby-version: ruby-2-6
|
52
|
+
- ruby-test:
|
53
|
+
ruby-version: ruby-2-7
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5 # keep in sync with .circleci/config.yml and gemspec
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
Style/EmptyMethod:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Metrics:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# not safe ... needs require 'English'
|
12
|
+
Style/SpecialGlobalVars:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 205 # TODO: lower
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Naming/AccessorMethodName:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Naming/MethodParameterName:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/IfInsideElse:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/GuardClause:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Lint/NestedMethodDefinition:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# TODO: fix
|
37
|
+
Style/StringConcatenation:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/NumericPredicate:
|
41
|
+
EnforcedStyle: comparison
|
42
|
+
|
43
|
+
Style/IfUnlessModifier:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Style/ClassAndModuleChildren:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
# TODO: enable ... somehow breaks tests
|
50
|
+
Style/HashEachMethods:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/WordArray:
|
54
|
+
EnforcedStyle: brackets
|
55
|
+
|
56
|
+
Style/SymbolArray:
|
57
|
+
EnforcedStyle: brackets
|
data/Gemfile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
|
-
gem 'codeclimate-test-reporter', '<1.0.0', :
|
4
|
-
gem 'rubocop'
|
5
|
+
gem 'codeclimate-test-reporter', '<1.0.0', group: :test, require: nil
|
6
|
+
gem 'rubocop'
|
5
7
|
|
6
8
|
# Specify your gem's dependencies in fluent-plugin-add.gemspec
|
7
9
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,47 +1,49 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-kubernetes_metadata_filter (2.
|
5
|
-
fluentd (>= 0.14.0, < 1.
|
6
|
-
kubeclient (< 5)
|
4
|
+
fluent-plugin-kubernetes_metadata_filter (2.11.1)
|
5
|
+
fluentd (>= 0.14.0, < 1.15)
|
6
|
+
kubeclient (>= 4.0.0, < 5.0.0)
|
7
7
|
lru_redux
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.
|
12
|
+
addressable (2.8.0)
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
14
|
-
ast (2.4.
|
15
|
-
bump (0.
|
14
|
+
ast (2.4.2)
|
15
|
+
bump (0.10.0)
|
16
16
|
charlock_holmes (0.7.7)
|
17
17
|
codeclimate-test-reporter (0.6.0)
|
18
18
|
simplecov (>= 0.7.1, < 1.0.0)
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
cool.io (1.
|
19
|
+
concurrent-ruby (1.1.10)
|
20
|
+
cool.io (1.7.1)
|
21
21
|
copyright-header (1.0.22)
|
22
22
|
github-linguist
|
23
|
-
crack (0.4.
|
24
|
-
|
25
|
-
docile (1.
|
23
|
+
crack (0.4.5)
|
24
|
+
rexml
|
25
|
+
docile (1.4.0)
|
26
26
|
domain_name (0.5.20190701)
|
27
27
|
unf (>= 0.0.5, < 1.0.0)
|
28
28
|
escape_utils (1.2.1)
|
29
|
-
ffi (1.
|
29
|
+
ffi (1.15.5)
|
30
30
|
ffi-compiler (1.0.1)
|
31
31
|
ffi (>= 1.0.0)
|
32
32
|
rake
|
33
|
-
fluentd (1.
|
33
|
+
fluentd (1.14.6)
|
34
|
+
bundler
|
34
35
|
cool.io (>= 1.4.5, < 2.0.0)
|
35
|
-
http_parser.rb (>= 0.5.1, < 0.
|
36
|
+
http_parser.rb (>= 0.5.1, < 0.9.0)
|
36
37
|
msgpack (>= 1.3.1, < 2.0.0)
|
37
|
-
serverengine (>= 2.
|
38
|
+
serverengine (>= 2.2.5, < 3.0.0)
|
38
39
|
sigdump (~> 0.2.2)
|
39
|
-
strptime (>= 0.2.
|
40
|
+
strptime (>= 0.2.4, < 1.0.0)
|
40
41
|
tzinfo (>= 1.0, < 3.0)
|
41
42
|
tzinfo-data (~> 1.0)
|
43
|
+
webrick (>= 1.4.2, < 1.8.0)
|
42
44
|
yajl-ruby (~> 1.0)
|
43
|
-
github-linguist (7.
|
44
|
-
charlock_holmes (~> 0.7.
|
45
|
+
github-linguist (7.17.0)
|
46
|
+
charlock_holmes (~> 0.7.7)
|
45
47
|
escape_utils (~> 1.2.0)
|
46
48
|
mini_mime (~> 1.0)
|
47
49
|
rugged (>= 0.25.1)
|
@@ -52,87 +54,87 @@ GEM
|
|
52
54
|
http-form_data (~> 2.2)
|
53
55
|
http-parser (~> 1.2.0)
|
54
56
|
http-accept (1.7.0)
|
55
|
-
http-cookie (1.0.
|
57
|
+
http-cookie (1.0.5)
|
56
58
|
domain_name (~> 0.5)
|
57
59
|
http-form_data (2.3.0)
|
58
|
-
http-parser (1.2.
|
60
|
+
http-parser (1.2.3)
|
59
61
|
ffi-compiler (>= 1.0, < 2.0)
|
60
|
-
http_parser.rb (0.
|
61
|
-
jsonpath (1.
|
62
|
+
http_parser.rb (0.8.0)
|
63
|
+
jsonpath (1.1.2)
|
62
64
|
multi_json
|
63
|
-
|
64
|
-
kubeclient (4.8.0)
|
65
|
+
kubeclient (4.9.3)
|
65
66
|
http (>= 3.0, < 5.0)
|
66
67
|
jsonpath (~> 1.0)
|
67
68
|
recursive-open-struct (~> 1.1, >= 1.1.1)
|
68
69
|
rest-client (~> 2.0)
|
69
70
|
lru_redux (1.1.0)
|
70
|
-
mime-types (3.
|
71
|
+
mime-types (3.4.1)
|
71
72
|
mime-types-data (~> 3.2015)
|
72
|
-
mime-types-data (3.
|
73
|
-
mini_mime (1.
|
73
|
+
mime-types-data (3.2022.0105)
|
74
|
+
mini_mime (1.1.2)
|
74
75
|
minitest (4.7.5)
|
75
|
-
msgpack (1.
|
76
|
+
msgpack (1.5.2)
|
76
77
|
multi_json (1.15.0)
|
77
78
|
netrc (0.11.0)
|
78
|
-
parallel (1.
|
79
|
-
parser (
|
79
|
+
parallel (1.21.0)
|
80
|
+
parser (3.0.2.0)
|
80
81
|
ast (~> 2.4.1)
|
81
|
-
power_assert (
|
82
|
-
public_suffix (4.0.
|
82
|
+
power_assert (2.0.1)
|
83
|
+
public_suffix (4.0.6)
|
83
84
|
rainbow (3.0.0)
|
84
|
-
rake (13.0.
|
85
|
-
recursive-open-struct (1.1.
|
86
|
-
regexp_parser (1.
|
85
|
+
rake (13.0.6)
|
86
|
+
recursive-open-struct (1.1.3)
|
87
|
+
regexp_parser (2.1.1)
|
87
88
|
rest-client (2.1.0)
|
88
89
|
http-accept (>= 1.7.0, < 2.0)
|
89
90
|
http-cookie (>= 1.0.2, < 2.0)
|
90
91
|
mime-types (>= 1.16, < 4.0)
|
91
92
|
netrc (~> 0.8)
|
92
|
-
rexml (3.2.
|
93
|
-
rr (
|
94
|
-
rubocop (
|
93
|
+
rexml (3.2.5)
|
94
|
+
rr (3.0.8)
|
95
|
+
rubocop (1.22.3)
|
95
96
|
parallel (~> 1.10)
|
96
|
-
parser (>=
|
97
|
+
parser (>= 3.0.0.0)
|
97
98
|
rainbow (>= 2.2.2, < 4.0)
|
98
|
-
regexp_parser (>= 1.
|
99
|
+
regexp_parser (>= 1.8, < 3.0)
|
99
100
|
rexml
|
100
|
-
rubocop-ast (>=
|
101
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
101
102
|
ruby-progressbar (~> 1.7)
|
102
|
-
unicode-display_width (>= 1.4.0, <
|
103
|
-
rubocop-ast (
|
104
|
-
parser (>=
|
105
|
-
ruby-progressbar (1.
|
106
|
-
rugged (1.0
|
107
|
-
|
108
|
-
serverengine (2.2.1)
|
103
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
104
|
+
rubocop-ast (1.12.0)
|
105
|
+
parser (>= 3.0.1.1)
|
106
|
+
ruby-progressbar (1.11.0)
|
107
|
+
rugged (1.2.0)
|
108
|
+
serverengine (2.3.0)
|
109
109
|
sigdump (~> 0.2.2)
|
110
110
|
sigdump (0.2.4)
|
111
|
-
simplecov (0.
|
111
|
+
simplecov (0.21.2)
|
112
112
|
docile (~> 1.1)
|
113
113
|
simplecov-html (~> 0.11)
|
114
|
-
|
115
|
-
|
114
|
+
simplecov_json_formatter (~> 0.1)
|
115
|
+
simplecov-html (0.12.3)
|
116
|
+
simplecov_json_formatter (0.1.3)
|
117
|
+
strptime (0.2.5)
|
116
118
|
test-unit (3.0.9)
|
117
119
|
power_assert
|
118
120
|
test-unit-rr (1.0.5)
|
119
121
|
rr (>= 1.1.1)
|
120
122
|
test-unit (>= 2.5.2)
|
121
|
-
|
122
|
-
tzinfo (2.0.2)
|
123
|
+
tzinfo (2.0.4)
|
123
124
|
concurrent-ruby (~> 1.0)
|
124
|
-
tzinfo-data (1.
|
125
|
+
tzinfo-data (1.2022.1)
|
125
126
|
tzinfo (>= 1.0.0)
|
126
127
|
unf (0.1.4)
|
127
128
|
unf_ext
|
128
|
-
unf_ext (0.0.
|
129
|
-
unicode-display_width (1.
|
129
|
+
unf_ext (0.0.8.2)
|
130
|
+
unicode-display_width (2.1.0)
|
130
131
|
vcr (6.0.0)
|
131
|
-
webmock (3.
|
132
|
-
addressable (>= 2.
|
132
|
+
webmock (3.14.0)
|
133
|
+
addressable (>= 2.8.0)
|
133
134
|
crack (>= 0.3.2)
|
134
135
|
hashdiff (>= 0.4.0, < 2.0.0)
|
135
|
-
|
136
|
+
webrick (1.7.0)
|
137
|
+
yajl-ruby (1.4.3)
|
136
138
|
|
137
139
|
PLATFORMS
|
138
140
|
ruby
|
@@ -153,4 +155,4 @@ DEPENDENCIES
|
|
153
155
|
yajl-ruby
|
154
156
|
|
155
157
|
BUNDLED WITH
|
156
|
-
2.
|
158
|
+
2.3.16
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
[](https://circleci.com/gh/fabric8io/fluent-plugin-kubernetes_metadata_filter)
|
3
3
|
[](https://codeclimate.com/github/fabric8io/fluent-plugin-kubernetes_metadata_filter)
|
4
4
|
[](https://codeclimate.com/github/fabric8io/fluent-plugin-kubernetes_metadata_filter)
|
5
|
+
[](https://github.com/rubocop-hq/rubocop)
|
6
|
+
[](https://rubystyle.guide)
|
5
7
|
|
6
8
|
The Kubernetes metadata plugin filter enriches container log records with pod and namespace metadata.
|
7
9
|
|
@@ -15,6 +17,7 @@ that rely on the authenticity of the namespace for proper log isolation.
|
|
15
17
|
|
16
18
|
| fluent-plugin-kubernetes_metadata_filter | fluentd | ruby |
|
17
19
|
|-------------------|---------|------|
|
20
|
+
| >= 2.10.0 | >= v1.10.0 | >= 2.6 |
|
18
21
|
| >= 2.5.0 | >= v1.10.0 | >= 2.5 |
|
19
22
|
| >= 2.0.0 | >= v0.14.20 | >= 2.1 |
|
20
23
|
| < 2.0.0 | >= v0.12.0 | >= 1.9 |
|
@@ -39,15 +42,17 @@ Configuration options for fluent.conf are:
|
|
39
42
|
* `client_key` - path to a client key file to authenticate to the API server
|
40
43
|
* `bearer_token_file` - path to a file containing the bearer token to use for authentication
|
41
44
|
* `tag_to_kubernetes_name_regexp` - the regular expression used to extract kubernetes metadata (pod name, container name, namespace) from the current fluentd tag.
|
42
|
-
This must
|
45
|
+
This must use named capture groups for `container_name`, `pod_name`, `namespace`, and either `pod_uuid (/var/log/pods)` or `docker_id (/var/log/containers)`
|
43
46
|
* `cache_size` - size of the cache of Kubernetes metadata to reduce requests to the API server (default: `1000`)
|
44
47
|
* `cache_ttl` - TTL in seconds of each cached element. Set to negative value to disable TTL eviction (default: `3600` - 1 hour)
|
45
48
|
* `watch` - set up a watch on pods on the API server for updates to metadata (default: `true`)
|
46
|
-
*
|
47
|
-
*
|
49
|
+
* *DEPRECATED*`de_dot` - replace dots in labels and annotations with configured `de_dot_separator`, required for Datadog and ElasticSearch 2.x compatibility (default: `true`)
|
50
|
+
* *DEPRECATED*`de_dot_separator` - separator to use if `de_dot` is enabled (default: `_`)
|
51
|
+
* *DEPRECATED*`de_slash` - replace slashes in labels and annotations with configured `de_slash_separator`, required for Datadog compatibility (default: `false`)
|
52
|
+
* *DEPRECATED*`de_slash_separator` - separator to use if `de_slash` is enabled (default: `__`)
|
48
53
|
* *DEPRECATED* `use_journal` - If false, 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. If unset (the default), the plugin will use the `CONTAINER_NAME` and `CONTAINER_ID_FULL` fields
|
49
54
|
if available, otherwise, will use the tag in the `tag_to_kubernetes_name_regexp` format.
|
50
|
-
* `container_name_to_kubernetes_regexp` - The regular expression used to extract the k8s metadata encoded in the journal `CONTAINER_NAME` field
|
55
|
+
* `container_name_to_kubernetes_regexp` - The regular expression used to extract the k8s metadata encoded in the journal `CONTAINER_NAME` field default: See [code](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter/blob/master/lib/fluent/plugin/filter_kubernetes_metadata.rb#L68)
|
51
56
|
* This corresponds to the definition [in the source](https://github.com/kubernetes/kubernetes/blob/release-1.6/pkg/kubelet/dockertools/docker.go#L317)
|
52
57
|
* `annotation_match` - Array of regular expressions matching annotation field names. Matched annotations are added to a log record.
|
53
58
|
* `allow_orphans` - Modify the namespace and namespace id to the values of `orphaned_namespace_name` and `orphaned_namespace_id`
|
@@ -64,23 +69,6 @@ when true (default: `true`)
|
|
64
69
|
* `skip_namespace_metadata` - Skip the namespace_id field from the metadata. The fetch_namespace_metadata function will be skipped. The plugin will be faster and cpu consumption will be less.
|
65
70
|
* `watch_retry_interval` - The time interval in seconds for retry backoffs when watch connections fail. (default: `10`)
|
66
71
|
|
67
|
-
**NOTE:** As of the release 2.1.x of this plugin, it no longer supports parsing the source message into JSON and attaching it to the
|
68
|
-
payload. The following configuration options are removed:
|
69
|
-
|
70
|
-
* `merge_json_log`
|
71
|
-
* `preserve_json_log`
|
72
|
-
|
73
|
-
One way of preserving JSON logs can be through the [parser plugin](https://docs.fluentd.org/filter/parser)
|
74
|
-
|
75
|
-
**NOTE** As of this release, the use of `use_journal` is **DEPRECATED**. If this setting is not present, the plugin will
|
76
|
-
attempt to figure out the source of the metadata fields from the following:
|
77
|
-
- If `lookup_from_k8s_field true` (the default) and the following fields are present in the record:
|
78
|
-
`docker.container_id`, `kubernetes.namespace_name`, `kubernetes.pod_name`, `kubernetes.container_name`,
|
79
|
-
then the plugin will use those values as the source to use to lookup the metadata
|
80
|
-
- If `use_journal true`, or `use_journal` is unset, and the fields `CONTAINER_NAME` and `CONTAINER_ID_FULL` are present in the record,
|
81
|
-
then the plugin will parse those values using `container_name_to_kubernetes_regexp` and use those as the source to lookup the metadata
|
82
|
-
- Otherwise, if the tag matches `tag_to_kubernetes_name_regexp`, the plugin will parse the tag and use those values to
|
83
|
-
lookup the metdata
|
84
72
|
|
85
73
|
Reading from the JSON formatted log files with `in_tail` and wildcard filenames while respecting the CRI-o log format with the same config you need the fluent-plugin "multi-format-parser":
|
86
74
|
|
@@ -150,22 +138,7 @@ Reading from the systemd journal (requires the fluentd `fluent-plugin-systemd` a
|
|
150
138
|
@type stdout
|
151
139
|
</match>
|
152
140
|
```
|
153
|
-
|
154
|
-
In former versions this plugin parsed the value of the key log as JSON. In the current version this feature was removed, to avoid duplicate features in the fluentd plugin ecosystem. It can parsed with the parser plugin like this:
|
155
|
-
```
|
156
|
-
<filter kubernetes.**>
|
157
|
-
@type parser
|
158
|
-
key_name log
|
159
|
-
<parse>
|
160
|
-
@type json
|
161
|
-
json_parser json
|
162
|
-
</parse>
|
163
|
-
replace_invalid_sequence true
|
164
|
-
reserve_data true # this preserves unparsable log lines
|
165
|
-
emit_invalid_record_to_error false # In case of unparsable log lines keep the error log clean
|
166
|
-
reserve_time # the time was already parsed in the source, we don't want to overwrite it with current time.
|
167
|
-
</filter>
|
168
|
-
```
|
141
|
+
|
169
142
|
|
170
143
|
## Environment variables for Kubernetes
|
171
144
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
1
4
|
require 'bundler/gem_tasks'
|
2
5
|
require 'rake/testtask'
|
3
6
|
require 'bump/tasks'
|
7
|
+
require 'rubocop/rake_task'
|
4
8
|
|
5
|
-
task :
|
9
|
+
task test: [:base_test]
|
10
|
+
task default: [:test, :build, :rubocop]
|
6
11
|
|
7
|
-
|
12
|
+
RuboCop::RakeTask.new
|
8
13
|
|
9
14
|
desc 'Run test_unit based test'
|
10
15
|
Rake::TestTask.new(:base_test) do |t|
|
@@ -13,7 +18,6 @@ Rake::TestTask.new(:base_test) do |t|
|
|
13
18
|
# $ bundle exec rake base_test TEST=test/test_*.rb
|
14
19
|
t.libs << 'test'
|
15
20
|
t.test_files = Dir['test/**/test_*.rb'].sort
|
16
|
-
#t.verbose = true
|
17
21
|
t.warning = false
|
18
22
|
end
|
19
23
|
|
@@ -23,15 +27,15 @@ task :headers do
|
|
23
27
|
require 'copyright_header'
|
24
28
|
|
25
29
|
args = {
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
30
|
+
license: 'Apache-2.0',
|
31
|
+
copyright_software: 'Fluentd Kubernetes Metadata Filter Plugin',
|
32
|
+
copyright_software_description: 'Enrich Fluentd events with Kubernetes metadata',
|
33
|
+
copyright_holders: ['Red Hat, Inc.'],
|
34
|
+
copyright_years: ['2015-2021'],
|
35
|
+
add_path: 'lib:test',
|
36
|
+
output_dir: '.'
|
33
37
|
}
|
34
38
|
|
35
|
-
command_line = CopyrightHeader::CommandLine.new(
|
39
|
+
command_line = CopyrightHeader::CommandLine.new(args)
|
36
40
|
command_line.execute
|
37
41
|
end
|
@@ -1,36 +1,34 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
|
5
6
|
Gem::Specification.new do |gem|
|
6
|
-
gem.name =
|
7
|
-
gem.version =
|
8
|
-
gem.authors = [
|
9
|
-
gem.email = [
|
10
|
-
gem.description =
|
11
|
-
gem.summary =
|
12
|
-
gem.homepage =
|
13
|
-
gem.license =
|
7
|
+
gem.name = 'fluent-plugin-kubernetes_metadata_filter'
|
8
|
+
gem.version = '2.11.1'
|
9
|
+
gem.authors = ['OpenShift Cluster Logging','Jimmi Dyson']
|
10
|
+
gem.email = ['team-logging@redhat.com','jimmidyson@gmail.com']
|
11
|
+
gem.description = 'Filter plugin to add Kubernetes metadata'
|
12
|
+
gem.summary = 'Fluentd filter plugin to add Kubernetes metadata'
|
13
|
+
gem.homepage = 'https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter'
|
14
|
+
gem.license = 'Apache-2.0'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
17
|
|
20
|
-
gem.required_ruby_version = '>= 2.
|
18
|
+
gem.required_ruby_version = '>= 2.5.0'
|
21
19
|
|
22
|
-
gem.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 1.
|
23
|
-
gem.add_runtime_dependency
|
24
|
-
gem.add_runtime_dependency
|
20
|
+
gem.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 1.15']
|
21
|
+
gem.add_runtime_dependency 'kubeclient', ['>= 4.0.0', '< 5.0.0']
|
22
|
+
gem.add_runtime_dependency 'lru_redux'
|
25
23
|
|
26
|
-
gem.add_development_dependency
|
27
|
-
gem.add_development_dependency
|
28
|
-
gem.add_development_dependency
|
29
|
-
gem.add_development_dependency
|
30
|
-
gem.add_development_dependency
|
31
|
-
gem.add_development_dependency
|
32
|
-
gem.add_development_dependency
|
33
|
-
gem.add_development_dependency
|
34
|
-
gem.add_development_dependency
|
35
|
-
gem.add_development_dependency
|
24
|
+
gem.add_development_dependency 'bump'
|
25
|
+
gem.add_development_dependency 'bundler', '~> 2.0'
|
26
|
+
gem.add_development_dependency 'copyright-header'
|
27
|
+
gem.add_development_dependency 'minitest', '~> 4.0'
|
28
|
+
gem.add_development_dependency 'rake'
|
29
|
+
gem.add_development_dependency 'test-unit', '~> 3.0.2'
|
30
|
+
gem.add_development_dependency 'test-unit-rr', '~> 1.0.3'
|
31
|
+
gem.add_development_dependency 'vcr'
|
32
|
+
gem.add_development_dependency 'webmock'
|
33
|
+
gem.add_development_dependency 'yajl-ruby'
|
36
34
|
end
|