Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move MESSAGE to message always #50

Merged
merged 1 commit into from
Aug 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions plugins/kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,33 @@ pipeline:
type: filter
expr: '$record._SYSTEMD_UNIT != "kubelet.service"'

# If MESSAGE field matches format then, parse it otherwise send down the pipeline.
# Move hostname to k8s node resource
- id: kubelet_resource
type: restructure
ops:
- move:
from: "$record._HOSTNAME"
to: "$resource['host.name']"
- move:
from: "MESSAGE"
to: "message"
- add:
field: "$resource['k8s.cluster.name']"
value: ""

# If message field matches format then, parse it otherwise send down the pipeline.
- id: kubelet_message_parser_router
type: router
routes:
- output: message_regex_parser
expr: '$record.MESSAGE matches "^\\w\\d{4}"'
expr: '$record.message matches "^\\w\\d{4}"'
- output: {{ .output }}
expr: true

# MESSAGE field seems to match expected format.
# message field seems to match expected format.
- id: message_regex_parser
type: regex_parser
parse_from: MESSAGE
parse_from: message
regex: '(?P<severity>\w)(?P<timestamp>\d{4} \d{2}:\d{2}:\d{2}.\d+)\s+(?P<pid>\d+)\s+(?P<source>[^ \]]+)\] (?P<message>.*)'
severity:
parse_from: severity
Expand Down