Langfuse v4: up to 165ร— faster ยท Read more
DocsData Retention

Data Retention

Where is this feature available?
  • Hobby
    Not Available
  • Core
    Not Available
  • Pro
    Available
  • Enterprise
    Available
  • Self Hosted
    Enterprise Edition

With Langfuse's Data Retention feature, you can control how long your event data (Traces, Observations, Scores, and Media Assets) is stored in Langfuse.

Project data retention does not delete audit logs or dataset items. If you add a trace to a dataset, the saved dataset item remains usable after the original trace expires. Adding a trace to a dataset does not protect the trace from deletion.

Configuration

Data retention is configured on a project level, and we accept a number of days with a minimum of 3 days. Project owners and administrators can change the setting in Project Settings โ†’ Data Retention.

Without a retention policy, Langfuse does not automatically delete event data (Traces, Observations, Scores, and Media Assets). On self-hosted instances, data is stored indefinitely by default. On Langfuse Cloud, each plan includes a data access window (Hobby: 30 days, Core: 90 days, Pro and Enterprise: 3 years); see pricing for details.

Configure data retention in Langfuse

Data retention can also be configured via the Organization Management API.

Details

On a nightly basis, Langfuse selects traces, observations, scores, and media assets that are older than the configured retention period and deletes them, except for media associated with saved dataset items (see Dataset media). We use the following properties per entity to decide whether they are outside the retention window:

  • Traces: timestamp
  • Observations: start_time
  • Scores: timestamp
  • Media Assets: created_at

Deleted assets cannot be recovered. If you need to preserve data beyond the retention window, you can set up a Blob Storage Export to automatically sync traces, observations, and scores to S3, GCS, or Azure on a recurring schedule.

What does project retention delete?

DataEffect of project retention
Traces, observations, and scoresDeleted when they fall outside the retention window, including those linked to datasets or experiments.
Audit logsUnaffected by project retention.
Datasets and dataset itemsUnaffected. Saved input, expected output, and metadata remain available.
Dataset runs and dataset run itemsThe records remain, but their linked experiment traces, observations, and scores can expire.
Media assets stored in LangfuseDeleted when they expire, unless associated with saved dataset items.

If I add a trace to a dataset, will the dataset item be deleted?

No. When you add a trace or observation to a dataset from the trace view, Langfuse saves the selected input, expected output, and metadata as a separate dataset item. It also stores a reference to the source trace or observation.

For example, with 30-day retention, after the source trace falls outside the retention window and cleanup deletes it:

  • The dataset item and its saved data remain available for future experiments.
  • The source link points to a deleted trace. You can no longer inspect the original trace's spans, timing, or other details through that link.

Adding an older trace to a dataset does not reset the trace's retention window.

What happens to experiment results?

Traces, observations, and scores created by experiments follow the project's retention policy too. Dataset run and run-item records do not preserve this linked data: once it expires, the corresponding trace details and scores are no longer available, even though the experiment records remain.

Dataset media

Langfuse-managed media associated with saved dataset items is excluded from retention deletion, including when the original trace expires. See multi-modal dataset items for how to save media with a dataset item.

External URLs are references to files hosted elsewhere. Saving an external URL in a dataset item does not copy the file into Langfuse or ensure that it remains available; its availability depends on the external host.

Self-hosted Instances

To use the Data Retention feature in a self-hosted environment, you need to grant s3:DeleteObject to the Langfuse IAM role on all buckets (see Blob Storage (S3) docs). Note that Langfuse only issues delete statements on the API. If you use versioned buckets, delete markers and non-current versions need to be removed manually or with a lifecycle rule.


Was this page helpful?

Last updated on