Metrics Retention Configuration
Guide to modifying the default 30-day metrics data retention period by editing the PROMETHEUS_RETENTION_TIME environment variable and restarting services.
By default, MariaDB Enterprise Manager retains detailed metrics for 30 days. You can configure this data retention period to balance your need for historical data with storage costs.
This guide explains how to change the retention period and how the underlying storage system works.
How to Change the Retention Period
Changing the retention time is done by editing the environment file for Enterprise Manager and then restarting the services.
Locate and edit the .env file
Navigate to your Enterprise Manager installation directory and open the .env file in a text editor.
cd enterprise-manager/
vim .envModify the retention time variable
Find the line containing PROMETHEUS_RETENTION_TIME and change its value. The change will only take effect after the Prometheus service is restarted.
Examples:
PROMETHEUS_RETENTION_TIME=90dPROMETHEUS_RETENTION_TIME=52wRestart services to apply the change
You must restart the services for the new retention period to be applied.
docker compose up -dData Retention Policy
Prometheus, the time-series database used by Enterprise Manager, does not delete expired data instantly.
Block-Based Storage: Prometheus stores metrics data in blocks, which are typically two-hour chunks of time. In the background, these small blocks are compacted into larger ones.
Delayed Cleanup: Data is not deleted on a sample-by-sample basis. Instead, Prometheus removes an entire block once all the data within it has passed the retention period. This cleanup process runs in the background and may not be immediate.
Valid Retention Time Units
When setting PROMETHEUS_RETENTION_TIME, you can use the following units:
y- yearsw- weeksd- daysh- hoursm- minutess- seconds
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

