Langfuse data retention policies

Self-hosted Langfuse retention is set per project, enforced by a nightly cleanup, and does not cover audit logs or dataset items. This page explains how to set one window across many projects and archive data before it expires.

On this page

How Langfuse data retention policies work in a self-hosted instance

A self-hosted Langfuse instance keeps event data indefinitely unless you set a retention policy. Retention is set per project, in days, with a minimum of 3 days, and on a self-hosted instance it requires the Enterprise license key. Once a window is set, a nightly job deletes traces, observations, scores and media assets older than that window. Deleted data cannot be recovered, so the policy is an irreversible decision, not a setting to try and revert.

Teams usually need a policy for one of three reasons: privacy obligations that limit how long personal data found in prompts and outputs may be kept, storage growth in ClickHouse and object storage that no one has budgeted for, or an internal data standard that sets a maximum age for production telemetry. Because retention is an Enterprise feature, confirm with your Langfuse contact or license terms that your instance holds a valid key before you plan around it. Without one, the policy cannot be applied, and the instance keeps accumulating data.

Age is judged by different timestamps depending on the record type: the trace timestamp for traces, the start_time for observations, the score timestamp for scores, and the created_at value for media. Confirm this in your test instance before you rely on it, because a trace that spans a window boundary can behave differently from what you expect. Decide the window with the people who own privacy and records obligations, record it, and check it against your storage sizing so the nightly job keeps ClickHouse disk use within the headroom you planned.

Retention configuration options and when each fits

This table compares the three ways to set retention in self-hosted Langfuse: the project settings UI, the Organization Management API and the startup variable for the first project. Read each row against your number of projects and how the instance is provisioned, then check the final row, because no organization-level policy exists and every project needs the same window set explicitly.

OptionWhat it doesFits best whenWatch for
Project settings UISets the retention window in days on one project from the project settings pageA single project or a handful of projects that a person can review by handEasy to drift across projects over time; each new project needs the same change made again
Organization Management APISets retention on each project through a script or automation callA fleet of projects where the same window must be applied consistently and repeatedRequires the Enterprise license key; the script must cover every project, including ones created later
LANGFUSE_INIT_PROJECT_RETENTIONSets retention for the project created when the instance starts for the first timeFresh instance provisioning where infrastructure is defined as code from the startApplies only to the startup project; other projects still need the UI or API
No organization-level policyRetention is not inherited from the organization or applied to all projects at onceNot a choice; it is a constraint to plan aroundEach project must carry the same explicit window, so confirm the value for every project in an audit
Minimum windowRetention must be at least 3 daysSetting a short window for test or sandbox projectsConfirm the value your team needs before applying it, since deleted data cannot be recovered
Default when unsetSelf-hosted instances store event data indefinitely without a policyOnly when you intend to keep all dataUnset projects keep growing storage until a policy is applied

Setting one retention window across many projects

This sequence gives every project in a self-hosted Langfuse instance the same retention window, confirms each setting by reading it back, and sets up a repeatable step for projects created later. Langfuse has no organization-level retention policy, so the work is done project by project.

  1. Confirm the Enterprise license key is active

    The platform team checks that the instance runs with a valid Enterprise license key, because project data retention requires the Enterprise Edition when self-hosted. Open the instance settings in the admin area and confirm the license status, then open a test project's settings and check that the retention field is available. If the field is missing, stop here, since none of the later steps will take effect.

  2. Decide the window for each data class

    Privacy, legal and security owners agree on how many days each kind of trace data should remain, and whether any data needs a different window. Retention is set in days with a minimum of 3 days, and the cleanup applies to traces, observations, scores and media assets by their own timestamps. Record the decision in a written retention standard that names the owner and the approval date. Without a policy, self-hosted instances store event data indefinitely, so this record is the baseline for the rest of the work.

  3. Set the window for the startup project

    Set LANGFUSE_INIT_PROJECT_RETENTION in the deployment configuration to the agreed number of days so that the project created at startup begins with the approved window. Apply the change through your normal configuration process and restart or redeploy as your setup requires. Confirm in the project settings UI that the retention value matches the number in the standard. Note that this variable only affects the project created at startup, so the remaining projects still need the next steps.

  4. List every project through the API

    Use the Organization Management API to list all organizations and the projects under each one, and save the output as an inventory with project identifiers and current retention values. Compare the list with the team's own project register to catch projects that exist but are not tracked. Record any project that already has a different retention value, because it will be overwritten in the next step. The inventory is complete when every project from the register appears in it.

  5. Apply the window to each project

    For each project in the inventory, set the retention value to the agreed number of days, either in the project settings UI or through the Organization Management API. Use a script for large numbers of projects so that each change is logged with the project identifier and time. Keep the script output with the change record. Each project is done when the API call or UI save returns success and the project appears in the log with the new value.

  6. Read back each project's retention setting

    Query each project again through the API and compare its retention value with the approved window. Investigate any mismatch before closing the change, including projects that were skipped or failed without an error message. Store the read-back output with the change record as evidence of the configured state. The step is done when every project in the inventory shows the approved value and no exceptions remain open.

  7. Confirm new projects inherit the window

    Create a test project and check that it does not start with the approved window automatically, because there is no organization-level retention policy. Document the provisioning procedure so that every new project receives the same retention value through the API or UI before any trace data arrives. Confirm the procedure with the team that creates projects, and schedule a periodic comparison between the register and the API inventory. Note that new projects must be added to this process, or they will keep indefinite storage until someone changes them.

Archiving data before it expires

Retention deletion cannot be reversed, so any data you will need for long-term analysis, cost review or evidence must leave Langfuse before the window closes. Each night the cleanup removes traces, observations, scores and media assets older than the project's retention period, judged by trace timestamp, observation start time, score timestamp and media creation time. Once that job runs, the data is gone from ClickHouse and the blob store, and Langfuse has no way to restore it. Because the deletion is silent, the safe pattern is to decide what must survive before you set the window, not after an auditor or a product team asks for it.

The choice of window is a trade-off. A shorter window limits how long personal data or sensitive prompt content sits in traces, which reduces exposure and storage growth, but it also shrinks the history available for debugging regressions, comparing model versions and answering questions about past behavior. A longer window keeps more history on the platform at the cost of more ClickHouse disk and a larger deletion scope if the data later proves sensitive. Set the number per project, document why, and confirm with your legal and security owners which data categories need a different answer. Remember that there is no organization-level policy, so the same value must be applied to every project and checked after each new project is created.

Backups and exports serve different purposes, and neither replaces the other. A backup of ClickHouse, PostgreSQL and blob storage is a disaster recovery copy that lets you rebuild the instance, and it is restored as a whole. An export is a copy of selected data in a format you can query later, outside the running platform, and it is the path for long-term retention. Project retention also leaves audit logs and dataset items in place, so those need their own plan. For the mechanics, see the sibling topics on scheduled export to blob storage for archiving and on backup and restore for disaster recovery. Confirm the export schedule, format and storage credentials before the first deletion date, and test a restore before you rely on either.

Security and operational risks of retention settings

Retention is a deletion control, so the risks run in both directions: too short a window removes evidence, and too long a window keeps personal data longer than needed. The cards below pair each risk with a check you can run before and after changing a window in self-hosted Langfuse.

Wrong window removes investigation data

Cleanup runs nightly and deleted traces, observations, scores and media cannot be recovered. Before setting a window, confirm with security and legal how far back incident investigations and disputed model outputs may need to reach. Record the agreed number of days and the date it was applied, and test the window on a non-production instance first. Illustrative: a window set to 3 days in a busy project would remove most of last week's traces on the next run.

Data retention docs

Missed projects keep their old window

There is no organization-level retention policy, so each project carries its own setting. Build a list of every project in the instance and check the retention value on each one after a change, whether you use the UI or the Organization Management API. Projects created later do not inherit the window automatically, so add a step to your onboarding checklist. Set LANGFUSE_INIT_PROJECT_RETENTION for the startup project so it is never left at the default.

Where it is set
Per project

Long windows widen privacy exposure

Without a policy, self-hosted instances store event data indefinitely, so personal data that reaches prompts or outputs stays until someone deletes it. Compare each project's window with the purpose it serves and the retention period in your privacy notice. Ask project owners which projects hold user content and set shorter windows there first. Pair retention with masking at the SDK so sensitive values are not stored in the first place.

Default without policy
Indefinite

Audit logs outlive deleted traces

Project retention does not delete audit logs, so records of who viewed, changed or exported data remain after the trace data they describe is gone. Plan for this when you write retention rules: audit logs have their own retention need and are not covered by the nightly cleanup. Confirm with your compliance team how long audit records must be kept, and check that the instance keeps them for that period. Do not assume a shorter trace window also shortens audit history.

Retention scope

Admin rights control the window

Changing retention is an administrative action that can remove data for every user in a project. Limit the role that can edit retention settings to a small named group, and review that group on a fixed schedule. Confirm the minimum project role needed to change retention in your instance, and check that viewers and members cannot reach the setting through the UI or API keys. Treat API keys used for provisioning as privileged credentials.

License needed
Enterprise

Changes need a reviewable trail

Changing a window is effectively a deletion decision, so keep a written record beside the audit log. Store each change with the old value, the new value, the approver and the reason, in your change management system or infrastructure as code. Use the same record when you run a check after the nightly cleanup. Reviewers should be able to match a change in your records to what the instance shows, so keep the project names and identifiers consistent.

Questions teams ask before setting Langfuse retention

How much effort does it take to apply one retention window across many projects?

Effort grows with the number of projects, because Langfuse has no organization-level retention policy. The same window must be set on each project in the UI or through the Organization Management API, and LANGFUSE_INIT_PROJECT_RETENTION only covers the project created at startup. Scripting the API calls is usually the practical route for a large set of projects, and the work then shifts to keeping the list of projects complete as new ones are created. Ask your partner or internal team to confirm how new projects will inherit the window, since the platform does not do this for you.

Does data retention require an Enterprise license for self-hosted Langfuse?

Yes. Data retention policies require the Enterprise Edition when Langfuse is self-hosted, and without a policy a self-hosted instance stores event data indefinitely. Other governance features, such as audit logs, project-level RBAC and server-side masking, also sit behind the Enterprise license key. For current plan terms and pricing, check the Langfuse self-hosted pricing page, which lists a free open source plan and a custom-priced Self-Hosted Enterprise plan. Confirm the exact license scope with the vendor before you commit to a retention design.

Can our own team set up retention without a partner?

Often yes, if you already run self-hosted Langfuse and have engineers comfortable with the API and the project model. The configuration itself is small: choose a window, set it on each project, and verify that the nightly cleanup behaves as expected. The harder parts are inventorying projects, agreeing the window with legal and data owners, and proving the setting held across every project. A partner is most useful when the project count is large or when the evidence needs to satisfy a formal review.

How long do setup and verification take?

The duration depends mainly on two things: how many projects must be configured and how long governance review takes. A small instance with a single project and a window already agreed can be configured quickly, while a large estate needs project inventory, scripted application, and a check of each project. Review by legal, privacy and data owners often takes longer than the technical work. No fixed duration applies to every environment, so ask for a timeline in the written scope that lists the project count and the approvals assumed.

What do we need to provide before retention work starts?

You need three things: named owners for each project and for the overall policy, a retention window decision per data class or project, and API access with an Enterprise-capable key for the Organization Management API. Owners confirm which projects hold personal data and whether any trace sets need different windows. Without a written window decision, the work cannot be verified against a standard. Ask your team to confirm who can approve changes, since a later window change is another configuration event that needs the same record.

Can deleted trace data be restored after the nightly cleanup?

No. Langfuse deletes traces, observations, scores and media assets older than the retention period during the nightly cleanup, and deleted data cannot be recovered. If you need a copy of data before it expires, archive it first, for example through a scheduled export to blob storage or a backup of the data stores taken before the window takes effect. Confirm the restore path for each data store with your operations team, because an export is not the same as a restore point.

Does retention delete audit logs and dataset items?

No. Project retention does not delete audit logs or dataset items, and media attached to saved dataset items is excluded from retention deletion. This means audit evidence and curated test data outlive the trace window. Plan for that when you assess storage growth and personal data exposure, because personal data held in audit logs or dataset items needs its own handling. Ask your compliance lead to confirm which records fall under the policy and which need a separate process.

How retention deletion moves through a self-hosted instance

The path starts when SDKs send traces to a project that has a retention window set in days, with a minimum of 3 days. Each night the worker checks trace timestamp, observation start_time, score timestamp and media created_at against that window, then deletes what is older. Audit logs and dataset items stay in place, and saved dataset media is excluded. Check that the window is set on every project, and archive to blob storage before expiry if you need the data later, because deleted data cannot be recovered.

Nightly retention deletion, the data that stays, and the archive branch before expiry.

How DeployOpen scopes retention work for self-hosted Langfuse

DeployOpen starts retention work by agreeing the retention window with your privacy, legal and platform owners before anyone changes a setting. The window is a business and legal decision: how long trace content, which can contain personal data, is worth keeping for debugging, evaluation and audit. Once that number is agreed, the engineering work is to apply it consistently to every project in your self-hosted Langfuse instance, because Langfuse has no organization-level retention policy. Each project needs the same window set in the UI or through the Organization Management API, and LANGFUSE_INIT_PROJECT_RETENTION covers only the project created at startup. Retention policies also require an Enterprise license key on a self-hosted instance, so that licensing decision belongs in the same scoping conversation.

The engagement then covers the parts of the retention design that a nightly cleanup does not handle. Project retention does not delete audit logs or dataset items, and media attached to saved dataset items is excluded, so the scope should list which of those data types need their own rules, owners and manual reviews. DeployOpen configures the windows inside your infrastructure, checks the deletion behavior against a test project in a non-production environment, and documents the settings, owners and decisions so your compliance and security teams can review them. Where archiving before expiry is needed, that work is scoped separately, because deleted data cannot be recovered.

DeployOpen prepares evidence for compliance assessments but does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those determinations. Engagements are fixed-scope: the scope, deliverables and timelines are agreed in writing before work starts, and any retention question that falls outside that scope is confirmed in writing before it is added. Ask for the written scope to name the projects covered, the owner who approves each window and the evidence the assessors will receive.

How DeployOpen delivers Langfuse retention and governance work

DeployOpen plans, implements and hands over per-project retention for self-hosted Langfuse inside your own infrastructure. We start from the retention windows your compliance and security owners approve, then make sure the Enterprise license, project settings, archiving and recovery steps are in place before any data expires.

How we scope

  • We list every Langfuse project and map each to the retention window your data owners approve.
  • We confirm whether your deployment holds an Enterprise license key, since project retention requires it when self-hosted.
  • The written scope names which data classes need archiving first, and which audit logs and dataset items stay outside retention.

How we build

  • We apply one agreed window across projects in the UI or through the Organization Management API, then record each setting.
  • We set LANGFUSE_INIT_PROJECT_RETENTION for the startup project so new installs do not store event data indefinitely.
  • We test the nightly cleanup on a non-production copy and confirm deleted data matches the approved window before go-live.

How we hand over

  • You receive a retention register listing each project, its window, its owner and the date it was last changed.
  • Runbooks cover the archiving schedule, the export path and the steps to confirm a cleanup ran as expected.
  • We walk your platform and compliance teams through what deletion cannot undo, so changes go through an approval step.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing retention reviews, Langfuse upgrades and continuous testing are available as a retainer.
  • Before any retention change, we confirm the current Langfuse version and its release notes, so the cleanup behavior matches your documentation.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.