Skip to content

Instantly share code, notes, and snippets.

@andrewkroh
Last active September 22, 2023 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewkroh/cc78673329903ebd8bdc509bae689bb6 to your computer and use it in GitHub Desktop.
Save andrewkroh/cc78673329903ebd8bdc509bae689bb6 to your computer and use it in GitHub Desktop.
Filebeat - processing kubelet json logs read from journald
filebeat.inputs:
- type: journald
processors:
# For https://kubernetes.io/docs/concepts/cluster-administration/system-logs/#json-log-format
- if:
and:
- equals.journald.process.name: kubelet
- regexp.message: '^{'
then:
# 'kubelet' should be mapped as a flattened field in ES because
# it can have arbitrary keys and value types.
- decode_json_fields:
fields:
- message
target: kubelet
- convert:
mode: rename
fields:
- { from: kubelet.msg, to: message }
- { from: kubelet.v, to: log.level, type: "string" }
- timestamp:
field: kubelet.ts
layouts:
- UNIX
test:
- '1580306777.04728'
- drop_fields:
fields:
- kubelet.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment