Janos Krnak
10/21/2025, 1:01 PMPREFECT_EVENTS_RETENTION_PERIOD on the background services or on the API side?Marvin
10/21/2025, 1:01 PMMarvin
10/21/2025, 1:07 PMPREFECT_SERVER_EVENTS_RETENTION_PERIOD (preferred, server-scoped) or PREFECT_EVENTS_RETENTION_PERIOD (supported alias). Default is 7 days (P7D).
Where to set it:
- Docker Compose: put the env var on the prefect-services container (the one running prefect server services). Setting it on the API container alone will not trigger pruning.
- Kubernetes/systemd/etc.: set it in the environment for the process that runs prefect server services.
Verify it’s applied (run this in the background services process/container/pod):
prefect config view | grep EVENTS_RETENTION
Helpful docs:
- Self-hosted with Docker Compose: Self-hosted Docker Compose
- Database maintenance (events retention): Database maintenance
- Settings reference: Settings reference
- EventPersister service: EventPersister