feat(logs): journald-Input — PVE/Nicht-Docker-Nodes lieferten bisher gar keine Logs
This commit is contained in:
1 parent
eea9f7fce4
commit
e1da311488
3 files changed
+45
-2
No files matched your search
+12
@@ -268,6 +268,18 @@ EOF
|
|||||||
esac
|
esac
|
||||||
[ "$HAS_APACHE" -eq 1 ] && [ "$ROLE" != "apache" ] && { fetch_conf telegraf/apache.conf /etc/telegraf/telegraf.d/apache.conf; usermod -aG adm telegraf 2>/dev/null || true; }
|
[ "$HAS_APACHE" -eq 1 ] && [ "$ROLE" != "apache" ] && { fetch_conf telegraf/apache.conf /etc/telegraf/telegraf.d/apache.conf; usermod -aG adm telegraf 2>/dev/null || true; }
|
||||||
|
|
||||||
|
# --- System-Logs (journald) → Loki — nur auf systemd-Systemen ---
|
||||||
|
if command -v journalctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
|
||||||
|
fetch_conf telegraf/journal.conf /etc/telegraf/telegraf.d/journal.conf
|
||||||
|
log "journald-Logs aktiv (Warnungen+ ab jetzt; PVE-Units inklusive)."
|
||||||
|
# Journal-Zugriff fuer den Dienst-Benutzer
|
||||||
|
if [ "$ROLE" = "proxmox" ]; then
|
||||||
|
: # laeuft als root (Drop-in) — voller Zugriff
|
||||||
|
else
|
||||||
|
usermod -aG systemd-journal telegraf 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# --- Node-Info (LAN-IP, NetBird-IP/FQDN, PVE-URL) — auf jeder Node ---
|
# --- Node-Info (LAN-IP, NetBird-IP/FQDN, PVE-URL) — auf jeder Node ---
|
||||||
fetch scripts/node-info.sh /etc/telegraf/node-info.sh
|
fetch scripts/node-info.sh /etc/telegraf/node-info.sh
|
||||||
chmod 0755 /etc/telegraf/node-info.sh
|
chmod 0755 /etc/telegraf/node-info.sh
|
||||||
|
|||||||
+2
-2
@@ -17,7 +17,7 @@
|
|||||||
url = "${PROM_URL}"
|
url = "${PROM_URL}"
|
||||||
data_format = "prometheusremotewrite"
|
data_format = "prometheusremotewrite"
|
||||||
timeout = "10s"
|
timeout = "10s"
|
||||||
namedrop = ["docker_log", "apache_log"]
|
namedrop = ["docker_log", "apache_log", "journal"]
|
||||||
[outputs.http.headers]
|
[outputs.http.headers]
|
||||||
Content-Type = "application/x-protobuf"
|
Content-Type = "application/x-protobuf"
|
||||||
Content-Encoding = "snappy"
|
Content-Encoding = "snappy"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
domain = "${LOKI_URL}"
|
domain = "${LOKI_URL}"
|
||||||
endpoint = "/loki/api/v1/push"
|
endpoint = "/loki/api/v1/push"
|
||||||
timeout = "10s"
|
timeout = "10s"
|
||||||
namepass = ["docker_log", "apache_log"]
|
namepass = ["docker_log", "apache_log", "journal"]
|
||||||
sanitize_label_names = true
|
sanitize_label_names = true
|
||||||
metric_name_label = ""
|
metric_name_label = ""
|
||||||
http_headers = { "Authorization" = "Bearer ${TELEGRAF_TOKEN}" }
|
http_headers = { "Authorization" = "Bearer ${TELEGRAF_TOKEN}" }
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# System-Logs (journald) → Loki
|
||||||
|
#
|
||||||
|
# Warum: inputs.docker_log deckt nur Container ab. PVE-Knoten und alle
|
||||||
|
# Nicht-Docker-Hosts lieferten damit gar keine Logs — genau dort stehen aber
|
||||||
|
# die relevanten Meldungen (pvedaemon, pveproxy, qemu, Kernel, Storage).
|
||||||
|
#
|
||||||
|
# Wichtig:
|
||||||
|
# - Läuft nur auf systemd-Systemen (kein Alpine/OpenRC).
|
||||||
|
# - Journal-Zugriff: Dienst läuft als root (Proxmox-Drop-in) bzw. braucht
|
||||||
|
# Mitgliedschaft in "systemd-journal". Der Installer setzt das per
|
||||||
|
# SupplementaryGroups, wenn als Benutzer "telegraf" gelaufen wird.
|
||||||
|
# - PVE/Cluster-Meldungen sind im Journal unter diesen Units zu finden:
|
||||||
|
# pvedaemon, pveproxy, pvestatd, pve-firewall, qmeventd, corosync, pmxcfs
|
||||||
|
|
||||||
|
[[inputs.journal]]
|
||||||
|
# Nur Warnungen und schlimmer — sonst flutet das Journal Loki.
|
||||||
|
# Für Debugging temporär auf "info" oder "debug" setzen.
|
||||||
|
units = [
|
||||||
|
"pvedaemon", "pveproxy", "pvestatd", "pve-firewall",
|
||||||
|
"qmeventd", "corosync", "pmxcfs", "pve-cluster",
|
||||||
|
"sshd", "systemd", "kernel", "smartd", "zfs-zed", "zfs",
|
||||||
|
"netbird", "telegraf", "docker", "containerd", "cron",
|
||||||
|
]
|
||||||
|
# Einheiten ohne Einträge liefern einfach nichts — kein Fehler.
|
||||||
|
priority = "warning" # warning, err, crit …
|
||||||
|
# Kein Nachholen alter Einträge beim Start
|
||||||
|
since = "-1h"
|
||||||
|
# Felder, die als Log-Zeile nutzbar sind (sonst nur Structured-Log)
|
||||||
|
fieldpass = ["MESSAGE", "PRIORITY", "SYSLOG_IDENTIFIER", "UNIT", "_HOSTNAME"]
|
||||||
|
# Kein doppeltes Logging: docker_log deckt Container ab
|
||||||
|
namepass = ["journal"]
|
||||||
Reference in new issue
Block a user