- deploy/loki/promtail-lxc.yaml: journald-based Promtail config for native LXC/systemd deployment; unit filter on bitreport-error-reporting-*.service; LOKI_PUSH_URL via env var expansion (-config.expand-env=true) - deploy/loki/systemd/promtail.service: systemd unit; loopback-only binding; EnvironmentFile=/etc/promtail/env for secrets - docs/deployment/loki-lxc-runbook.md: full operational runbook — Loki on central obs CT, Promtail on app LXC, firewall, smoke LogQL queries - docs/OBSERVABILITY_LOKI.md: document production topology divergence vs lab compose; update configuration files table Paperclip-Task: BIT-21663 Paperclip-Agent: tiago-neves
49 lines
1.9 KiB
Desktop File
49 lines
1.9 KiB
Desktop File
# systemd unit for Promtail on the errors.bitreport.pt app LXC.
|
|
# Ships journald logs from the four bitreport-error-reporting-*.service units
|
|
# to the central Loki instance.
|
|
#
|
|
# Installation (run as root on the app LXC):
|
|
# cp this file /etc/systemd/system/bitreport-promtail.service
|
|
# systemctl daemon-reload
|
|
# systemctl enable --now bitreport-promtail.service
|
|
#
|
|
# Required before enabling:
|
|
# 1. Binary installed: /usr/local/bin/promtail (see runbook)
|
|
# 2. Config deployed: /etc/promtail/promtail-lxc.yaml
|
|
# 3. Data directory: install -d -m 0750 -o promtail -g promtail /var/lib/promtail
|
|
# 4. User created: useradd --system --no-create-home --shell /usr/sbin/nologin promtail
|
|
# usermod -aG systemd-journal promtail
|
|
# 5. Set LOKI_PUSH_URL in /etc/promtail/env (no quotes, no export):
|
|
# LOKI_PUSH_URL=http://<central-loki-ip>:3100/loki/api/v1/push
|
|
#
|
|
# Full runbook: docs/deployment/loki-lxc-runbook.md
|
|
|
|
[Unit]
|
|
Description=Promtail — errors-hub log shipper to central Loki
|
|
Documentation=https://grafana.com/docs/loki/latest/send-data/promtail/
|
|
After=network.target
|
|
# Start after the app services so journal entries are already flowing.
|
|
After=bitreport-error-reporting-ingest-api.service
|
|
After=bitreport-error-reporting-api.service
|
|
After=bitreport-error-reporting-collector-worker.service
|
|
After=bitreport-error-reporting-admin-ui.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=promtail
|
|
Group=promtail
|
|
# Read LOKI_PUSH_URL from a separate secrets file (not in git).
|
|
EnvironmentFile=/etc/promtail/env
|
|
ExecStart=/usr/local/bin/promtail \
|
|
-config.file=/etc/promtail/promtail-lxc.yaml \
|
|
-config.expand-env=true
|
|
Restart=on-failure
|
|
RestartSec=10s
|
|
# Cap memory; Promtail is lightweight — adjust if ingestion volume grows.
|
|
MemoryMax=128M
|
|
# Journal read requires supplementary group membership (usermod -aG systemd-journal promtail).
|
|
# No extra SupplementaryGroups= directive needed when usermod is used.
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|