Add `promtail` config to monitor `consul`.

This commit is contained in:
Kazuhiro MUSASHI 2020-09-20 15:39:31 +09:00
parent e0668afe05
commit 5cf6f09a03
1 changed files with 38 additions and 0 deletions

View File

@ -242,3 +242,41 @@ scrape_configs:
regex: '.*(cron|supervisor|ssh|promtail|local|grafana|motd|dnsmasq|snapd|logind|init|session|loki|monit).*'
source_labels:
- __journal__systemd_unit
- job_name: consul
static_configs:
- targets:
- localhost
labels:
job: consul
hostname: <%= @HOSTNAME %>
__path__: /var/log/supervisor/consul.log
pipeline_stages:
- match:
selector: '{job="consul"}'
stages:
- regex:
expression: '^ +(?P<timestamp>\d+-\d+-[^T]+T\d+:\d+:\d+\.\d+\+\d+) \[(?P<level>[^\]]+)\] (?P<message>.+)$'
- timestamp:
source: timestamp
format: 2006-01-02T15:04:05.000-0700
- template:
source: level
template: '{{ ToLower .level }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral "warn" .Value "warning" }}'
- template:
source: level
template: '{{ regexReplaceAllLiteral "crit" .Value "critical" }}'
- labels:
level:
- output:
source: message