Run Log Retention Policy #83

Open
opened 2026-02-23 10:08:13 +00:00 by ottomata · 0 comments
Owner

Context

Over time, run logs will grow unboundedly. A configurable retention policy automatically purges old data.

Tasks

  • Add LOG_RETENTION_DAYS to Config struct (default: 30)
  • Create a background goroutine in main.go that:
    • Runs a cleanup tick every 24 hours
    • Deletes run_logs rows where logged_at < NOW() - INTERVAL '<retention> days'
    • Deletes runs rows where created_at < NOW() - INTERVAL '<retention> days' AND status is terminal
    • Logs the number of rows deleted at INFO level
  • Add sqlc queries: DeleteOldRunLogs :exec, DeleteOldRuns :exec
  • The cleanup goroutine is stopped cleanly during graceful shutdown
  • Add GET /admin/config endpoint (Admin only) returning current system config including log_retention_days
### Context Over time, run logs will grow unboundedly. A configurable retention policy automatically purges old data. ### Tasks - [ ] Add `LOG_RETENTION_DAYS` to `Config` struct (default: 30) - [ ] Create a background goroutine in `main.go` that: - Runs a cleanup tick every 24 hours - Deletes `run_logs` rows where `logged_at < NOW() - INTERVAL '<retention> days'` - Deletes `runs` rows where `created_at < NOW() - INTERVAL '<retention> days'` AND `status` is terminal - Logs the number of rows deleted at INFO level - [ ] Add sqlc queries: `DeleteOldRunLogs :exec`, `DeleteOldRuns :exec` - [ ] The cleanup goroutine is stopped cleanly during graceful shutdown - [ ] Add `GET /admin/config` endpoint (Admin only) returning current system config including `log_retention_days`
ottomata added this to the Phase 8 project 2026-02-23 10:09:19 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ottomata/acsm#83
No description provided.