From 81822f12d3e7763711952a874a88eacdc9814f7d Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Mon, 21 Sep 2020 00:19:52 +0900 Subject: [PATCH] Modify `promtail` config for `init` journal. --- .../promtail/templates/etc/promtail/base.yaml | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cookbooks/promtail/templates/etc/promtail/base.yaml b/cookbooks/promtail/templates/etc/promtail/base.yaml index 3f73651..46df03b 100644 --- a/cookbooks/promtail/templates/etc/promtail/base.yaml +++ b/cookbooks/promtail/templates/etc/promtail/base.yaml @@ -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'