<@ULVA73B9P> in a self hosted prefect 3.x setup, s...
# ask-marvin
j
@Marvin in a self hosted prefect 3.x setup, should I define the
PREFECT_EVENTS_RETENTION_PERIOD
on the background services or on the API side?
m
thought for 379.3 seconds
Short answer: set it on the background services, not just the API. - The pruning of old events is performed by the EventPersister, which runs as part of the background services process. Only the process running background services reads and applies the retention period for deletion. - Use either
PREFECT_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):
Copy code
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