Date: 15-01-2026 Status: TERMINE Duree: ~2h
Grafana ne voyait que 3 sources de logs (containers Docker prod-portainer uniquement). Objectif : centraliser TOUS les logs vers Loki et archiver sur O2switch.
/stock_8to/33800-stack/scripts/logs/install-promtail.sh/stock_8to/33800-stack/scripts/logs/sync-logs-o2switch.sh| Fichier | Action |
|---|---|
| /stock_8to/33800-stack/scripts/logs/install-promtail.sh | Créé |
| /stock_8to/33800-stack/scripts/logs/sync-logs-o2switch.sh | Créé |
| /etc/cron.d/sync-logs-o2switch | Créé |
| /stock_8to/33800-stack/docker/stacks/monitoring/docker-compose.yml | Modifié (Loki/Promtail 3.0) |
| /stock_8to/33800-stack/docker/stacks/monitoring/promtail-config.yml | Modifié (Docker SD) |
| /stock_8to/33800-stack/docker/stacks/monitoring/loki-config.yml | Modifié (3.0 compat) |
| /etc/promtail/config.yml (gitlab) | Créé |
| /etc/promtail/config.yml (dev-portainer) | Créé |
| ~/.claude/CLAUDE.md | Modifié (section Logging + symlinks) |
| Métrique | Avant | Après |
|---|---|---|
| Hosts dans Loki | 1 | 5 |
| Containers détectés | ~3 | 29 |
| Labels standardisés | Non | Oui |
| Archivage O2switch | Non | Oui (cron 3h) |
env: prod | dev
host: pve | nginx | gitlab | prod-portainer | dev-portainer
type: system | app | cron | access | error
service: docker | nginx | gitlab | ...
container: ntfy | loki | grafana | ...
stack: monitoring | notifications | ...
# Vérifier hosts dans Loki
curl -s "http://192.168.1.12:3100/loki/api/v1/label/host/values" | jq
# Vérifier containers
curl -s "http://192.168.1.12:3100/loki/api/v1/label/container/values" | jq
# Installer Promtail sur nouvelle machine
scp /stock_8to/33800-stack/scripts/logs/install-promtail.sh user@machine:/tmp/
ssh user@machine "sudo /tmp/install-promtail.sh <hostname>"