Project Retention Policies
In Phoenix 9.0 or greater you can automatically purge traces from projects by configuring a retention policy. Retention policies can be either time based or trace count based.
A retention policy starts deleting traces that are outside of the retention window
Default. Every project in your instance is associated with this retention policy unless specified otherwise. The Default policy also specifies 0 days, which is equal to “Indefinite” retention.
Configuring the Default Retention Policy
The default retention policy can be configured at deployment time using thePHOENIX_DEFAULT_RETENTION_POLICY_DAYS environment variable. This is particularly useful for self-hosted deployments where you want to set a consistent retention policy across all projects from the start.
Environment Variable Configuration:
PHOENIX_DEFAULT_RETENTION_POLICY_DAYS=0(default) - Infinite retention, no automatic cleanupPHOENIX_DEFAULT_RETENTION_POLICY_DAYS=30- Automatically delete traces older than 30 daysPHOENIX_DEFAULT_RETENTION_POLICY_DAYS=7- Automatically delete traces older than 7 days
values.yaml:
- This setting only affects the default retention policy that applies to all projects
- Individual projects can still override this setting through the Phoenix UI
- Changes to this environment variable will update the default policy for new projects but won’t affect existing project-specific policies
- The cleanup runs on a scheduled basis (weekly by default) as configured in the retention policy

By default phoenix retains all the data you send it
Data Retention tab and create a new policy.

Create a new retention policy to associate with projects
- name - a human friendly name for others to understand it (e.g. “one week”)
- rule - number of max days and or number of traces that will cause traces to be purged
- schedule - a CRON schedule for when the policy will be enforced. It’s recommended to do it during non-business hours for the least amount of disruption (if there is any)

Select your new policy in the project config tab
Deleting Traces Manually
You can either delete traces by time or individually. To delete traces older than a certain date, click on the action button on a project and selectremove data

Click Remove Data. You will be able to delete traces older than a certain date.

Select a date. Traces older than the given date will be purged.
How to configure retention policies

