Ops: logrotate fuer /var/log/gwoe-*.log #171

Closed
opened 2026-05-03 13:19:42 +02:00 by tobias · 1 comment
Owner

Problem

Die GWÖ-Antragspruefer-Cron-Logs unter /var/log/gwoe-*.log wachsen unrotated.
Stand 2026-05-03:

Datei Groesse Zuwachs/Tag (geschaetzt)
gwoe-monitoring.log 100 KB ~3 KB (Cron 30 6 * * *)
gwoe-ingest-protocols.log 36 KB ~1 KB (Cron 30 6 * * *)
gwoe-dev-deploy.log 16 KB ~500 B (Cron */5 * * * *, nur bei Aenderung)
gwoe-digest.log 4 KB ~100 B (Cron 0 7 * * *)
gwoe-dev-backup.log 4 KB ~150 B (Cron 30 3 * * *)
gwoe-fetch-news.log 0 KB (neu, #170) ~1 KB

Bei aktueller Wachstumsrate (~6 KB/Tag insgesamt) sind das in einem Jahr ~2 MB —
nicht akut bedrohlich, aber:

  • Operations-Hygiene
  • Bei einem Bug-Storm (Container-Crash-Loop) koennte ein Log schnell auf hunderte
    MB wachsen und Disk fuellen
  • Backup-Run liest die DB-Files, die Log-Files sind nicht im Backup — ein riesiges
    Log-File wuerde nichts kaputt machen, aber waere unschoen

Loesung

/etc/logrotate.d/gwoe mit Eintrag fuer alle /var/log/gwoe-*.log:

/var/log/gwoe-*.log {
    weekly
    rotate 8
    compress
    delaycompress
    missingok
    notifempty
    create 0644 dotty dotty
    sharedscripts
}
  • weekly — Cron-Logs sind nicht so traffic-intensiv
  • rotate 8 — 8 Wochen Historie reicht fuer Forensik bei Cron-Bugs
  • compress — gz fuer alte Logs
  • delaycompress — letzte rotation bleibt unkomprimiert (greppable)
  • create 0644 dotty dotty — passt zur bestehenden Permissions-Konvention

Akzeptanzkriterien

  • /etc/logrotate.d/gwoe existiert mit obiger Config
  • sudo logrotate -d /etc/logrotate.d/gwoe zeigt keine Errors
  • Nach 1 Woche: /var/log/gwoe-*.log.1 existiert (oder .gz-Variante nach 2 Wochen)
  • sharedscripts ist gesetzt, damit pro Lauf nur 1× postrotate (falls je hinzugefuegt)

Out of Scope

  • Container-interne Logs (uvicorn, FastAPI access-logs in Docker) — die werden
    von Docker selbst rotiert via docker logs --max-size. Falls noch nicht
    konfiguriert: separates Issue.
  • App-Audit-Log (Login-Events, Bewertungs-Events) — gibt es heute nicht,
    ist nicht Teil dieses Issues.

Aufwand

Kurz — 1 Datei, 1 Test-Run, 1 Verify nach 1 Woche.

## Problem Die GWÖ-Antragspruefer-Cron-Logs unter `/var/log/gwoe-*.log` wachsen unrotated. Stand 2026-05-03: | Datei | Groesse | Zuwachs/Tag (geschaetzt) | |---|---|---| | `gwoe-monitoring.log` | 100 KB | ~3 KB (Cron 30 6 * * *) | | `gwoe-ingest-protocols.log` | 36 KB | ~1 KB (Cron 30 6 * * *) | | `gwoe-dev-deploy.log` | 16 KB | ~500 B (Cron */5 * * * *, nur bei Aenderung) | | `gwoe-digest.log` | 4 KB | ~100 B (Cron 0 7 * * *) | | `gwoe-dev-backup.log` | 4 KB | ~150 B (Cron 30 3 * * *) | | `gwoe-fetch-news.log` | 0 KB (neu, #170) | ~1 KB | Bei aktueller Wachstumsrate (~6 KB/Tag insgesamt) sind das in einem Jahr ~2 MB — nicht akut bedrohlich, aber: - Operations-Hygiene - Bei einem Bug-Storm (Container-Crash-Loop) koennte ein Log schnell auf hunderte MB wachsen und Disk fuellen - Backup-Run liest die DB-Files, die Log-Files sind nicht im Backup — ein riesiges Log-File wuerde nichts kaputt machen, aber waere unschoen ## Loesung `/etc/logrotate.d/gwoe` mit Eintrag fuer alle `/var/log/gwoe-*.log`: ``` /var/log/gwoe-*.log { weekly rotate 8 compress delaycompress missingok notifempty create 0644 dotty dotty sharedscripts } ``` - **weekly** — Cron-Logs sind nicht so traffic-intensiv - **rotate 8** — 8 Wochen Historie reicht fuer Forensik bei Cron-Bugs - **compress** — gz fuer alte Logs - **delaycompress** — letzte rotation bleibt unkomprimiert (greppable) - **create 0644 dotty dotty** — passt zur bestehenden Permissions-Konvention ## Akzeptanzkriterien - [ ] `/etc/logrotate.d/gwoe` existiert mit obiger Config - [ ] `sudo logrotate -d /etc/logrotate.d/gwoe` zeigt keine Errors - [ ] Nach 1 Woche: `/var/log/gwoe-*.log.1` existiert (oder `.gz`-Variante nach 2 Wochen) - [ ] `sharedscripts` ist gesetzt, damit pro Lauf nur 1× postrotate (falls je hinzugefuegt) ## Out of Scope - **Container-interne Logs** (uvicorn, FastAPI access-logs in Docker) — die werden von Docker selbst rotiert via `docker logs --max-size`. Falls noch nicht konfiguriert: separates Issue. - **App-Audit-Log** (Login-Events, Bewertungs-Events) — gibt es heute nicht, ist nicht Teil dieses Issues. ## Aufwand Kurz — 1 Datei, 1 Test-Run, 1 Verify nach 1 Woche.
Author
Owner

Implementiert + auf vserver installiert (commit 0fd8a72).

/etc/logrotate.d/gwoe ist aktiv:

  • weekly, rotate 8, compress, delaycompress
  • create 0644 dotty dotty (passt zur Konvention)

Dry-Run sauber. logrotate-Cron laeuft taeglich, naechste tatsaechliche Rotation in ca. 1 Woche.

Closing.

Implementiert + auf vserver installiert (commit 0fd8a72). `/etc/logrotate.d/gwoe` ist aktiv: - weekly, rotate 8, compress, delaycompress - create 0644 dotty dotty (passt zur Konvention) Dry-Run sauber. logrotate-Cron laeuft taeglich, naechste tatsaechliche Rotation in ca. 1 Woche. Closing.
Sign in to join this conversation.
No description provided.