Merge branch 'promtail-journal-modify' of kazu634/itamae into master

This commit is contained in:
Kazuhiro MUSASHI 2020-09-21 00:24:13 +09:00 committed by Gitea
commit b1ea22a262
1 changed files with 47 additions and 2 deletions

View File

@ -208,9 +208,29 @@ scrape_configs:
path: /var/log/journal
labels:
job: init
level: notice
hostname: <%= @HOSTNAME %>
pipeline_stages:
- match:
selector: '{job="init"} |~ "(apt download|Message of the Day)"'
stages:
- template:
source: level
template: 'info'
- labels:
level:
- match:
selector: '{job="init"} !~ "(apt download|Message of the Day)"'
stages:
- template:
source: level
template: 'notice'
- labels:
level:
relabel_configs:
- action: keep
regex: 'init\.scope'
@ -229,11 +249,36 @@ scrape_configs:
pipeline_stages:
- match:
selector: '{job="systemd"}'
selector: '{job="systemd"} !~ "temperature"'
stages:
- drop:
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:
- source_labels: ['__journal__systemd_unit']
target_label: 'unit'