You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/filebeat/running-on-kubernetes.md
+94-8Lines changed: 94 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,9 +179,59 @@ ingest new log data.
179
179
180
180
The following are examples of configurations for ingesting rotated log files:
181
181
182
-
:::::{tab-set}
182
+
::::{tab-set}
183
+
:group: log-rotation
183
184
184
-
::::{tab-item} Single input
185
+
:::{tab-item} GA 9.3
186
+
:sync: ga-9-3
187
+
188
+
Use a single [filestream](/reference/filebeat/filebeat-input-filestream.md) input to ingest all container logs.
189
+
190
+
```yaml
191
+
filebeat.inputs:
192
+
- type: filestream
193
+
id: kubernetes-container-logs
194
+
compression: auto <1>
195
+
parsers:
196
+
- container: ~
197
+
paths:
198
+
- /var/log/pods/*/*/*.log* <2>
199
+
prospector:
200
+
scanner:
201
+
fingerprint.enabled: true
202
+
file_identity.fingerprint: ~
203
+
processors:
204
+
- add_kubernetes_metadata:
205
+
host: ${NODE_NAME}
206
+
default_indexers.enabled: false
207
+
default_matchers.enabled: false
208
+
indexers:
209
+
- pod_uid:
210
+
matchers:
211
+
- logs_path:
212
+
logs_path: "/var/log/pods/" <3>
213
+
resource_type: "pod" <3>
214
+
```
215
+
216
+
1. {applies_to}`stack: ga 9.3.0` Enable gzip detection and decompression. Refer to [Reading GZIP files](/reference/filebeat/filebeat-input-filestream.md#reading-gzip-files).
217
+
218
+
2. `/var/log/pods/` contains the active log files as well as the rotated log files.
219
+
220
+
3. `add_kubernetes_metadata` needs to be configured to match pod metadata based
221
+
on the new path, `/var/log/pods/`.
222
+
223
+
:::{note}
224
+
With this configuration, [add_kubernetes_metadata](/reference/filebeat/add-kubernetes-metadata.md#_logs_path)
225
+
adds pod metadata, which does not include
226
+
container data (such as `kubernetes.container.name`). If you need container
227
+
metadata, you must consider using autodiscover instead. Refer to the
228
+
[autodiscover documentation](/reference/filebeat/configuration-autodiscover.md#_kubernetes) for details.
229
+
:::
230
+
231
+
:::
232
+
233
+
:::{tab-item} Beta 9.2
234
+
:sync: beta-9-2
185
235
186
236
Use a single [filestream](/reference/filebeat/filebeat-input-filestream.md) input to ingest all container logs.
187
237
@@ -216,7 +266,7 @@ Use a single [filestream](/reference/filebeat/filebeat-input-filestream.md) inpu
216
266
2. `/var/log/pods/` contains the active log files as well as the rotated log files.
217
267
218
268
3. `add_kubernetes_metadata` needs to be configured to match pod metadata based
219
-
on the new path, `/var/log/pods/`.
269
+
on the new path, `/var/log/pods/`.
220
270
221
271
:::{note}
222
272
With this configuration, [add_kubernetes_metadata](/reference/filebeat/add-kubernetes-metadata.md#_logs_path)
@@ -226,14 +276,49 @@ metadata, you must consider using autodiscover instead. Refer to the
226
276
[autodiscover documentation](/reference/filebeat/configuration-autodiscover.md#_kubernetes) for details.
227
277
:::
228
278
279
+
:::
280
+
229
281
::::
230
282
231
-
::::{tab-item} One input per container
283
+
### One input per container
232
284
233
-
Use [autodiscover](//reference/filebeat/configuration-autodiscover.md#_kubernetes) to generate a
234
-
[filestream](/reference/filebeat/filebeat-input-filestream.md) input per
285
+
Use [autodiscover](//reference/filebeat/configuration-autodiscover.md#_kubernetes) to generate a
286
+
[filestream](/reference/filebeat/filebeat-input-filestream.md) input per
1. {applies_to}`stack: ga 9.3.0` Enable gzip detection and decompression. Refer to [Reading GZIP files](/reference/filebeat/filebeat-input-filestream.md#reading-gzip-files).
312
+
313
+
2. `/var/log/pods/` contains the active log files as well as the rotated log files.
314
+
The input is configured to only read logs from the container it's for.
0 commit comments