Skip to content

Commit 2aa97cd

Browse files
committed
test
1 parent 8c0bf66 commit 2aa97cd

File tree

1 file changed

+94
-8
lines changed

1 file changed

+94
-8
lines changed

docs/reference/filebeat/running-on-kubernetes.md

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,59 @@ ingest new log data.
179179

180180
The following are examples of configurations for ingesting rotated log files:
181181

182-
:::::{tab-set}
182+
::::{tab-set}
183+
:group: log-rotation
183184

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
185235

186236
Use a single [filestream](/reference/filebeat/filebeat-input-filestream.md) input to ingest all container logs.
187237

@@ -216,7 +266,7 @@ Use a single [filestream](/reference/filebeat/filebeat-input-filestream.md) inpu
216266
2. `/var/log/pods/` contains the active log files as well as the rotated log files.
217267

218268
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/`.
220270

221271
:::{note}
222272
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
226276
[autodiscover documentation](/reference/filebeat/configuration-autodiscover.md#_kubernetes) for details.
227277
:::
228278

279+
:::
280+
229281
::::
230282

231-
::::{tab-item} One input per container
283+
### One input per container
232284

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
235287
container.
236288

289+
::::{tab-set}
290+
:group: log-rotation
291+
292+
:::{tab-item} GA 9.3
293+
:sync: ga-9-3
294+
295+
296+
```yaml
297+
filebeat.autodiscover:
298+
id: kubernetes-container-logs-${data.kubernetes.pod.uid}-${data.kubernetes.container.name}
299+
compression: auto <1>
300+
paths:
301+
- /var/log/pods/${data.kubernetes.namespace}_${data.kubernetes.pod.name}_${data.kubernetes.pod.uid}/${data.kubernetes.container.name}/*.log* <2>
302+
303+
parsers:
304+
- container: ~
305+
prospector:
306+
scanner:
307+
fingerprint.enabled: true
308+
file_identity.fingerprint: ~
309+
```
310+
311+
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.
315+
316+
:::
317+
318+
:::{tab-item} Beta 9.2
319+
:sync: beta-9-2
320+
321+
237322
```yaml
238323
filebeat.autodiscover:
239324
id: kubernetes-container-logs-${data.kubernetes.pod.uid}-${data.kubernetes.container.name}
@@ -252,11 +337,12 @@ container.
252337
1. {applies_to}`stack: beta 9.2.0` Enable gzip decompression. Refer to [Reading GZIP files](/reference/filebeat/filebeat-input-filestream.md#reading-gzip-files).
253338

254339
2. `/var/log/pods/` contains the active log files as well as the rotated log files.
255-
The input is configured to only read logs from the container it's for.
340+
The input is configured to only read logs from the container it's for.
341+
342+
:::
256343

257344
::::
258345

259-
:::::
260346

261347
## Load {{kib}} dashboards [_load_kib_dashboards]
262348

0 commit comments

Comments
 (0)