> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcollate.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Retention Application

# Data Retention Application

The **Data Retention** application in **OpenMetadata** automates the cleanup of the internal database to maintain long-term performance and prevent data bloat. It provides administrators with an efficient mechanism to define retention policies for event-related records, ensuring scalability and compliance with data management practices.

## Overview

As **OpenMetadata** processes events related to metadata changes and pipeline executions, it stores these events in internal tables. Over time, these tables can grow significantly and affect system performance. The **Data Retention App** enables automated and scheduled cleanup of outdated records.

### Key Features

* Automated cleanup of outdated internal records.
* Configurable retention periods for different data categories.
* Helps maintain system performance and database efficiency.
* Supports compliance with organizational data retention policies.

## Configuration Options

* **Configuration Key:** `changeEventRetentionPeriod`
  **Description:** The number of days to retain change event records
  **Default Value:** `7`

* **Configuration Key:** `activityThreadsRetentionPeriod`
  **Description:** The number of days to retain activity feed records
  **Default Value:** `60`

<Tip>
  The retention period is applied to each cleanup target based on its timestamp.
</Tip>

## Cleanup Targets

The app deletes old records from the following internal tables:

* **change\_events:** Stores all metadata change event logs.
* **successful\_sent\_change\_events:** Tracks successfully processed events.
* **consumers\_dlq:** Dead Letter Queue for failed events.

## Implementation Details

* **Schedule:** Runs weekly by default.
* **Cron:** `0 0 * * 0` (every Sunday at midnight).
* **Batch Processing:** Cleans up records in batches of 10,000.
* **Triggering:** Can be executed manually or allowed to run on schedule.
* **Application Class:** `org.openmetadata.service.apps.bundles.dataRetention.DataRetention`
* **Permission Requirement:** Requires admin privileges to configure or trigger.

## How to Access

1. Go to **Settings > Applications** and then click on **Add apps**.

<img noZoom src="https://mintcdn.com/collatedocs/rwgp94CnO_DBWElR/public/images/applications/ret.png?fit=max&auto=format&n=rwgp94CnO_DBWElR&q=85&s=8b7656960f254d9da9f0878c832ac002" alt="Install Data Retention Application" width="2943" height="1424" data-path="public/images/applications/ret.png" />

2. Select or install the **Data Retention** application.

<img noZoom src="https://mintcdn.com/collatedocs/rwgp94CnO_DBWElR/public/images/applications/ret1.png?fit=max&auto=format&n=rwgp94CnO_DBWElR&q=85&s=9c250ad9fb0ccbd8c8303ded0d7f9363" alt="Install Data Retention Application" width="2943" height="1424" data-path="public/images/applications/ret1.png" />

3. Configure the desired retention period.

<img noZoom src="https://mintcdn.com/collatedocs/rwgp94CnO_DBWElR/public/images/applications/ret2.png?fit=max&auto=format&n=rwgp94CnO_DBWElR&q=85&s=6e28ccbbeeb2a1f6d680c84690d6f7e8" alt="configuration" width="2943" height="1424" data-path="public/images/applications/ret2.png" />

4. Run manually or let it operate on its default schedule.

<img noZoom src="https://mintcdn.com/collatedocs/rwgp94CnO_DBWElR/public/images/applications/ret3.png?fit=max&auto=format&n=rwgp94CnO_DBWElR&q=85&s=673a5c014d3824a93a897b7e4a6c78ea" alt="scheduling" width="2943" height="1424" data-path="public/images/applications/ret3.png" />
