Skip to content

Commit 6b6a3b2

Browse files
authored
fix: Update filelog receiver operators in kubernetes docs (#5697)
1 parent 5fb7900 commit 6b6a3b2

File tree

1 file changed

+4
-68
lines changed

1 file changed

+4
-68
lines changed

content/en/docs/kubernetes/collector/components.md

+4-68
Original file line numberDiff line numberDiff line change
@@ -283,77 +283,13 @@ filelog:
283283
exclude:
284284
# Exclude logs from all containers named otel-collector
285285
- /var/log/pods/*/otel-collector/*.log
286-
start_at: beginning
286+
start_at: end
287287
include_file_path: true
288288
include_file_name: false
289289
operators:
290-
# Find out which format is used by kubernetes
291-
- type: router
292-
id: get-format
293-
routes:
294-
- output: parser-docker
295-
expr: 'body matches "^\\{"'
296-
- output: parser-crio
297-
expr: 'body matches "^[^ Z]+ "'
298-
- output: parser-containerd
299-
expr: 'body matches "^[^ Z]+Z"'
300-
# Parse CRI-O format
301-
- type: regex_parser
302-
id: parser-crio
303-
regex:
304-
'^(?P<time>[^ Z]+) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*)
305-
?(?P<log>.*)$'
306-
output: extract_metadata_from_filepath
307-
timestamp:
308-
parse_from: attributes.time
309-
layout_type: gotime
310-
layout: '2006-01-02T15:04:05.999999999Z07:00'
311-
# Parse CRI-Containerd format
312-
- type: regex_parser
313-
id: parser-containerd
314-
regex:
315-
'^(?P<time>[^ ^Z]+Z) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*)
316-
?(?P<log>.*)$'
317-
output: extract_metadata_from_filepath
318-
timestamp:
319-
parse_from: attributes.time
320-
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
321-
# Parse Docker format
322-
- type: json_parser
323-
id: parser-docker
324-
output: extract_metadata_from_filepath
325-
timestamp:
326-
parse_from: attributes.time
327-
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
328-
- type: move
329-
from: attributes.log
330-
to: body
331-
# Extract metadata from file path
332-
- type: regex_parser
333-
id: extract_metadata_from_filepath
334-
regex: '^.*\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[a-f0-9\-]{36})\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$'
335-
parse_from: attributes["log.file.path"]
336-
cache:
337-
size: 128 # default maximum amount of Pods per Node is 110
338-
# Rename attributes
339-
- type: move
340-
from: attributes.stream
341-
to: attributes["log.iostream"]
342-
- type: move
343-
from: attributes.container_name
344-
to: resource["k8s.container.name"]
345-
- type: move
346-
from: attributes.namespace
347-
to: resource["k8s.namespace.name"]
348-
- type: move
349-
from: attributes.pod_name
350-
to: resource["k8s.pod.name"]
351-
- type: move
352-
from: attributes.restart_count
353-
to: resource["k8s.container.restart_count"]
354-
- type: move
355-
from: attributes.uid
356-
to: resource["k8s.pod.uid"]
290+
# parse container logs
291+
- type: container
292+
id: container-parser
357293
```
358294

359295
For Filelog Receiver configuration details, see

0 commit comments

Comments
 (0)