Modify `promtail` config for `systemd`.

This commit is contained in:
Kazuhiro MUSASHI 2020-09-21 00:20:34 +09:00
parent 81822f12d3
commit 0d3d8fe800
1 changed files with 26 additions and 1 deletions

View File

@ -249,11 +249,36 @@ scrape_configs:
pipeline_stages: pipeline_stages:
- match: - match:
selector: '{job="systemd"}' selector: '{job="systemd"} !~ "temperature"'
stages: stages:
- drop: - drop:
expression: (CMD|UFW|session|TTY) expression: (CMD|UFW|session|TTY)
- match:
selector: '{job="systemd"} |~ "temperature"'
stages:
- regex:
expression: '^(?P<message>.+)$'
- template:
source: level
template: '{{ .message }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral ".*normal.*" .Value "notice" }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral ".*temperature.*" .Value "error" }}'
- labels:
level:
- output:
source: message
relabel_configs: relabel_configs:
- source_labels: ['__journal__systemd_unit'] - source_labels: ['__journal__systemd_unit']
target_label: 'unit' target_label: 'unit'