fluent-plugin-kubernetes_metadata_filter 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5d86f8aaca3c3fffa77b39ea1bf73d5176ee518e
4
- data.tar.gz: 681f0b65a2e7ff7b73bac23dc7e9f02fcb2f11de
2
+ SHA256:
3
+ metadata.gz: a221d8fa203e3a37486010781387ef2407e1cf68133530d029344981be45b51d
4
+ data.tar.gz: 4e38e559dd5e9a98d8819778d7a293dfbc537bfaccab5fdae2fd19572b794ad2
5
5
  SHA512:
6
- metadata.gz: 2f0f86f42ec6e6276f532d58d64c656608cae4290c26dd2f22c3365ff7787cc830b8ec60bacb418acf4e8c1fff7cb911dc972ccf55cf15e7ee49433b87117b9b
7
- data.tar.gz: 48e27fc22bc59fdc929a5d9c8bbf833e77aaf1d5ad9d90d32bf1e451fe53adf01809a5f76bb3c2854b355064ce386830f30073b1b9340823419cfce851341fd0
6
+ metadata.gz: d205ea159f0a54edcc58a9e0794079c2aa5772269ed589156d587adf78b22380669d164013675227750cabca826cab29144ef2cfaa5bf0704eb72efb365d89e3
7
+ data.tar.gz: d43b8aa7415ebda5df028e4a63113db79a928a202b110791b70c65dfae877d5a77465957326fb370c4e5bba1951a1338c0382572b1269b36d580ad0f377ed6f4
data/README.md CHANGED
@@ -60,13 +60,16 @@ when true (default: `true`)
60
60
  * `skip_labels` - Skip all label fields from the metadata.
61
61
  * `skip_container_metadata` - Skip some of the container data of the metadata. The metadata will not contain the container_image and container_image_id fields.
62
62
  * `skip_master_url` - Skip the master_url field from the metadata.
63
- * `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.
63
+ * `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.
64
+
64
65
  **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
65
66
  payload. The following configuration options are removed:
66
67
 
67
68
  * `merge_json_log`
68
69
  * `preserve_json_log`
69
70
 
71
+ One way of preserving JSON logs can be through the [parser plugin](https://docs.fluentd.org/filter/parser)
72
+
70
73
  **NOTE** As of this release, the use of `use_journal` is **DEPRECATED**. If this setting is not present, the plugin will
71
74
  attempt to figure out the source of the metadata fields from the following:
72
75
  - If `lookup_from_k8s_field true` (the default) and the following fields are present in the record:
@@ -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 = "2.2.0"
7
+ gem.version = "2.3.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}
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 2']
23
23
  gem.add_runtime_dependency "lru_redux"
24
- gem.add_runtime_dependency "kubeclient", "~> 1.1.4"
24
+ gem.add_runtime_dependency "kubeclient", '< 5'
25
25
 
26
26
  gem.add_development_dependency "bundler", "~> 1.3"
27
27
  gem.add_development_dependency "rake"
@@ -136,7 +136,7 @@ module Fluent::Plugin
136
136
  metadata = parse_namespace_metadata(metadata)
137
137
  @stats.bump(:namespace_cache_api_updates)
138
138
  log.trace("parsed metadata for #{namespace_name}: #{metadata}") if log.trace?
139
- @namespace_cache[metadata['namespace_id']] = metadata
139
+ @namespace_cache[metadata['namespace_id']] = metadata
140
140
  return metadata
141
141
  rescue Exception => e
142
142
  log.debug(e)
@@ -164,7 +164,6 @@ module Fluent::Plugin
164
164
  end
165
165
 
166
166
  require 'kubeclient'
167
- require 'active_support/core_ext/object/blank'
168
167
  require 'lru_redux'
169
168
  @stats = KubernetesMetadata::Stats.new
170
169
 
@@ -111,3 +111,29 @@ module KubernetesMetadata
111
111
 
112
112
  end
113
113
  end
114
+
115
+ # copied from activesupport
116
+ class Object
117
+ # An object is blank if it's false, empty, or a whitespace string.
118
+ # For example, +nil+, '', ' ', [], {}, and +false+ are all blank.
119
+ #
120
+ # This simplifies
121
+ #
122
+ # !address || address.empty?
123
+ #
124
+ # to
125
+ #
126
+ # address.blank?
127
+ #
128
+ # @return [true, false]
129
+ def blank?
130
+ respond_to?(:empty?) ? !!empty? : !self
131
+ end
132
+
133
+ # An object is present if it's not blank.
134
+ #
135
+ # @return [true, false]
136
+ def present?
137
+ !blank?
138
+ end
139
+ end
@@ -18,40 +18,6 @@
18
18
  #
19
19
  ---
20
20
  http_interactions:
21
- - request:
22
- method: get
23
- uri: https://localhost:8443/api
24
- body:
25
- encoding: US-ASCII
26
- string: ''
27
- headers:
28
- Accept:
29
- - "*/*; q=0.5, application/xml"
30
- Accept-Encoding:
31
- - gzip, deflate
32
- User-Agent:
33
- - Ruby
34
- response:
35
- status:
36
- code: 200
37
- message: OK
38
- headers:
39
- Content-Type:
40
- - application/json
41
- Date:
42
- - Fri, 08 May 2015 10:35:37 GMT
43
- Content-Length:
44
- - '67'
45
- body:
46
- encoding: UTF-8
47
- string: |-
48
- {
49
- "versions": [
50
- "v1"
51
- ]
52
- }
53
- http_version:
54
- recorded_at: Fri, 08 May 2015 10:35:37 GMT
55
21
  - request:
56
22
  method: get
57
23
  uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
@@ -18,40 +18,6 @@
18
18
  #
19
19
  ---
20
20
  http_interactions:
21
- - request:
22
- method: get
23
- uri: https://localhost:8443/api
24
- body:
25
- encoding: US-ASCII
26
- string: ''
27
- headers:
28
- Accept:
29
- - "*/*; q=0.5, application/xml"
30
- Accept-Encoding:
31
- - gzip, deflate
32
- User-Agent:
33
- - Ruby
34
- response:
35
- status:
36
- code: 200
37
- message: OK
38
- headers:
39
- Content-Type:
40
- - application/json
41
- Date:
42
- - Fri, 08 May 2015 10:35:37 GMT
43
- Content-Length:
44
- - '67'
45
- body:
46
- encoding: UTF-8
47
- string: |-
48
- {
49
- "versions": [
50
- "v1"
51
- ]
52
- }
53
- http_version:
54
- recorded_at: Fri, 08 May 2015 10:35:37 GMT
55
21
  - request:
56
22
  method: get
57
23
  uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
@@ -0,0 +1,193 @@
1
+ #
2
+ # Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
3
+ # Kubernetes metadata
4
+ #
5
+ # Copyright 2015 Red Hat, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ ---
20
+ http_interactions:
21
+ - request:
22
+ method: get
23
+ uri: https://localhost:8443/api/v1
24
+ body:
25
+ encoding: US-ASCII
26
+ string: ''
27
+ headers:
28
+ Accept:
29
+ - "*/*; q=0.5, application/xml"
30
+ Accept-Encoding:
31
+ - gzip, deflate
32
+ User-Agent:
33
+ - Ruby
34
+ response:
35
+ status:
36
+ code: 200
37
+ message: OK
38
+ headers:
39
+ Content-Type:
40
+ - application/json
41
+ Date:
42
+ - Fri, 08 May 2015 10:35:37 GMT
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: |-
48
+ {
49
+ "kind": "APIResourceList",
50
+ "groupVersion": "v1",
51
+ "resources": [
52
+ {
53
+ "name": "bindings",
54
+ "singularName": "",
55
+ "namespaced": true,
56
+ "kind": "Binding",
57
+ "verbs": [
58
+ "create"
59
+ ]
60
+ },
61
+ {
62
+ "name": "namespaces",
63
+ "singularName": "",
64
+ "namespaced": false,
65
+ "kind": "Namespace",
66
+ "verbs": [
67
+ "create",
68
+ "delete",
69
+ "get",
70
+ "list",
71
+ "patch",
72
+ "update",
73
+ "watch"
74
+ ],
75
+ "shortNames": [
76
+ "ns"
77
+ ]
78
+ },
79
+ {
80
+ "name": "namespaces/finalize",
81
+ "singularName": "",
82
+ "namespaced": false,
83
+ "kind": "Namespace",
84
+ "verbs": [
85
+ "update"
86
+ ]
87
+ },
88
+ {
89
+ "name": "namespaces/status",
90
+ "singularName": "",
91
+ "namespaced": false,
92
+ "kind": "Namespace",
93
+ "verbs": [
94
+ "get",
95
+ "patch",
96
+ "update"
97
+ ]
98
+ },
99
+ {
100
+ "name": "pods",
101
+ "singularName": "",
102
+ "namespaced": true,
103
+ "kind": "Pod",
104
+ "verbs": [
105
+ "create",
106
+ "delete",
107
+ "deletecollection",
108
+ "get",
109
+ "list",
110
+ "patch",
111
+ "update",
112
+ "watch"
113
+ ],
114
+ "shortNames": [
115
+ "po"
116
+ ],
117
+ "categories": [
118
+ "all"
119
+ ]
120
+ },
121
+ {
122
+ "name": "pods/attach",
123
+ "singularName": "",
124
+ "namespaced": true,
125
+ "kind": "Pod",
126
+ "verbs": []
127
+ },
128
+ {
129
+ "name": "pods/binding",
130
+ "singularName": "",
131
+ "namespaced": true,
132
+ "kind": "Binding",
133
+ "verbs": [
134
+ "create"
135
+ ]
136
+ },
137
+ {
138
+ "name": "pods/eviction",
139
+ "singularName": "",
140
+ "namespaced": true,
141
+ "group": "policy",
142
+ "version": "v1beta1",
143
+ "kind": "Eviction",
144
+ "verbs": [
145
+ "create"
146
+ ]
147
+ },
148
+ {
149
+ "name": "pods/exec",
150
+ "singularName": "",
151
+ "namespaced": true,
152
+ "kind": "Pod",
153
+ "verbs": []
154
+ },
155
+ {
156
+ "name": "pods/log",
157
+ "singularName": "",
158
+ "namespaced": true,
159
+ "kind": "Pod",
160
+ "verbs": [
161
+ "get"
162
+ ]
163
+ },
164
+ {
165
+ "name": "pods/portforward",
166
+ "singularName": "",
167
+ "namespaced": true,
168
+ "kind": "Pod",
169
+ "verbs": []
170
+ },
171
+ {
172
+ "name": "pods/proxy",
173
+ "singularName": "",
174
+ "namespaced": true,
175
+ "kind": "Pod",
176
+ "verbs": []
177
+ },
178
+ {
179
+ "name": "pods/status",
180
+ "singularName": "",
181
+ "namespaced": true,
182
+ "kind": "Pod",
183
+ "verbs": [
184
+ "get",
185
+ "patch",
186
+ "update"
187
+ ]
188
+ }
189
+ ]
190
+ }
191
+ http_version:
192
+ recorded_at: Fri, 08 May 2015 10:35:37 GMT
193
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,195 @@
1
+ #
2
+ # Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
3
+ # Kubernetes metadata
4
+ #
5
+ # Copyright 2015 Red Hat, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ ---
20
+ http_interactions:
21
+ - request:
22
+ method: get
23
+ uri: https://localhost:8443/api/v1
24
+ body:
25
+ encoding: US-ASCII
26
+ string: ''
27
+ headers:
28
+ Accept:
29
+ - "*/*; q=0.5, application/xml"
30
+ Accept-Encoding:
31
+ - gzip, deflate
32
+ User-Agent:
33
+ - Ruby
34
+ Authorization:
35
+ - Bearer YzYyYzFlODMtODdhNS00ZTMyLWIzMmItNmY4NDc4OTI1ZWFh
36
+ response:
37
+ status:
38
+ code: 200
39
+ message: OK
40
+ headers:
41
+ Content-Type:
42
+ - application/json
43
+ Date:
44
+ - Fri, 08 May 2015 10:35:37 GMT
45
+ Transfer-Encoding:
46
+ - chunked
47
+ body:
48
+ encoding: UTF-8
49
+ string: |-
50
+ {
51
+ "kind": "APIResourceList",
52
+ "groupVersion": "v1",
53
+ "resources": [
54
+ {
55
+ "name": "bindings",
56
+ "singularName": "",
57
+ "namespaced": true,
58
+ "kind": "Binding",
59
+ "verbs": [
60
+ "create"
61
+ ]
62
+ },
63
+ {
64
+ "name": "namespaces",
65
+ "singularName": "",
66
+ "namespaced": false,
67
+ "kind": "Namespace",
68
+ "verbs": [
69
+ "create",
70
+ "delete",
71
+ "get",
72
+ "list",
73
+ "patch",
74
+ "update",
75
+ "watch"
76
+ ],
77
+ "shortNames": [
78
+ "ns"
79
+ ]
80
+ },
81
+ {
82
+ "name": "namespaces/finalize",
83
+ "singularName": "",
84
+ "namespaced": false,
85
+ "kind": "Namespace",
86
+ "verbs": [
87
+ "update"
88
+ ]
89
+ },
90
+ {
91
+ "name": "namespaces/status",
92
+ "singularName": "",
93
+ "namespaced": false,
94
+ "kind": "Namespace",
95
+ "verbs": [
96
+ "get",
97
+ "patch",
98
+ "update"
99
+ ]
100
+ },
101
+ {
102
+ "name": "pods",
103
+ "singularName": "",
104
+ "namespaced": true,
105
+ "kind": "Pod",
106
+ "verbs": [
107
+ "create",
108
+ "delete",
109
+ "deletecollection",
110
+ "get",
111
+ "list",
112
+ "patch",
113
+ "update",
114
+ "watch"
115
+ ],
116
+ "shortNames": [
117
+ "po"
118
+ ],
119
+ "categories": [
120
+ "all"
121
+ ]
122
+ },
123
+ {
124
+ "name": "pods/attach",
125
+ "singularName": "",
126
+ "namespaced": true,
127
+ "kind": "Pod",
128
+ "verbs": []
129
+ },
130
+ {
131
+ "name": "pods/binding",
132
+ "singularName": "",
133
+ "namespaced": true,
134
+ "kind": "Binding",
135
+ "verbs": [
136
+ "create"
137
+ ]
138
+ },
139
+ {
140
+ "name": "pods/eviction",
141
+ "singularName": "",
142
+ "namespaced": true,
143
+ "group": "policy",
144
+ "version": "v1beta1",
145
+ "kind": "Eviction",
146
+ "verbs": [
147
+ "create"
148
+ ]
149
+ },
150
+ {
151
+ "name": "pods/exec",
152
+ "singularName": "",
153
+ "namespaced": true,
154
+ "kind": "Pod",
155
+ "verbs": []
156
+ },
157
+ {
158
+ "name": "pods/log",
159
+ "singularName": "",
160
+ "namespaced": true,
161
+ "kind": "Pod",
162
+ "verbs": [
163
+ "get"
164
+ ]
165
+ },
166
+ {
167
+ "name": "pods/portforward",
168
+ "singularName": "",
169
+ "namespaced": true,
170
+ "kind": "Pod",
171
+ "verbs": []
172
+ },
173
+ {
174
+ "name": "pods/proxy",
175
+ "singularName": "",
176
+ "namespaced": true,
177
+ "kind": "Pod",
178
+ "verbs": []
179
+ },
180
+ {
181
+ "name": "pods/status",
182
+ "singularName": "",
183
+ "namespaced": true,
184
+ "kind": "Pod",
185
+ "verbs": [
186
+ "get",
187
+ "patch",
188
+ "update"
189
+ ]
190
+ }
191
+ ]
192
+ }
193
+ http_version:
194
+ recorded_at: Fri, 08 May 2015 10:35:37 GMT
195
+ recorded_with: VCR 2.9.3