infra/nix/hosts/loki/modules/promtail/promtail.yaml
2026-01-05 23:09:19 +01:00

118 lines
3.4 KiB
YAML

server:
disable: true
http_listen_port: 28183
grpc_listen_port: 0
positions:
filename: /var/tmp/positions.yaml
clients:
- url: http://127.0.0.1:3100/loki/api/v1/push
tenant_id: ""
backoff_config:
min_period: 1000ms
max_period: 5m
max_retries: 10000
scrape_configs:
- job_name: journal
journal:
# max_age: 12h
max_age: 14400h
labels:
job: systemd-journal
host: loki
relabel_configs:
- source_labels: ["__journal__systemd_unit"]
target_label: "unit"
- source_labels: ['__journal__hostname']
target_label: nodename
- source_labels: ['__journal_syslog_identifier']
target_label: syslog_identifier
# drop these because of excessive logging
- action: drop
regex: '.*tailscale.*'
source_labels: ['__journal__systemd_unit', 'unit']
- action: drop
regex: '.*zfs-zed.*'
source_labels: ['__journal__systemd_unit', 'unit', 'syslog_identifier']
- action: drop
regex: '.*zed.*'
source_labels: ['__journal__systemd_unit', 'unit', 'syslog_identifier']
- job_name: caddy
static_configs:
- targets:
- localhost
labels:
job: caddy
host: loki
__path__: /var/log/caddy/*log
agent: caddy-promtail
pipeline_stages:
- json:
expressions:
duration: duration
status: status
- labels:
duration:
status:
- job_name: syslog-receiver-mikrotik
syslog:
# listen_address: 127.0.0.1:40514
listen_address: 0.0.0.0:40515
listen_protocol: tcp
# Don't disconnect the forwarder
idle_timeout: 12h
# syslog_format: rfc5424
syslog_format: rfc3164
# use_incoming_timestamp: true
labels:
job: syslog-receiver
relabel_configs:
- source_labels: ['__syslog_message_hostname']
target_label: host
- source_labels: ['__syslog_message_hostname']
target_label: instance
- source_labels: ['__syslog_connection_hostname']
target_label: 'syslog_host'
# - source_labels: ['__syslog_message_hostname']
# target_label: nodename
- source_labels: ['__syslog_message_severity']
target_label: level
- source_labels: ['__syslog_message_facility']
target_label: syslog_facility
- source_labels: ['__syslog_message_app_name']
target_label: application
- job_name: syslog-receiver
syslog:
# listen_address: 127.0.0.1:40514
listen_address: localhost:40514
# Don't disconnect the forwarder
idle_timeout: 12h
syslog_format: rfc5424
# syslog_format: rfc3164
# use_incoming_timestamp: true
labels:
job: syslog-receiver
# label_structured_data: yes
# Copy syslog bits to standard labels
relabel_configs:
- source_labels: ['__syslog_message_hostname']
target_label: host
- source_labels: ['__syslog_connection_hostname']
target_label: 'syslog_host'
# - source_labels: ['__syslog_message_hostname']
# target_label: nodename
- source_labels: ['__syslog_message_severity']
target_label: level
- source_labels: ['__syslog_message_facility']
target_label: syslog_facility
- source_labels: ['__syslog_message_app_name']
target_label: syslog_identifier
# - source_labels: ['__syslog_message_app_name']
# target_label: application