infra/roles/monitoring/templates/promtail.yml

29 lines
663 B
YAML

server:
log_level: warn
http_listen_port: 9080
grpc_listen_port: 0
clients:
- url: http://monitoring-0:3100/loki/api/v1/push
external_labels:
hostname: "{{ inventory_hostname }}"
scrape_configs:
- job_name: journald
journal:
labels:
job: systemd-label
relabel_configs:
- source_labels: ['__journal__systemd_unit']
target_label: 'unit'
{% if logs is defined and 'jobs' in logs %}
{% for job_name, path in logs.jobs.items() %}
- job_name: {{ job_name }}
static_configs:
- targets:
- localhost
labels:
job: {{ job_name }}
__path__: {{ path }}
{% endfor %}
{% endif %}