Closed Stoobiedoo closed 2 months ago
I'm not an expert on Prometheus, so please correct me if I'm mistaken.
In the docker-compose.yml
file, under the prometheus
service, under the command
section, you can add the following options to ensure that the data for the last 15 days is always kept (for example) under 10 GB:
- '--storage.tsdb.retention.time=15d' # Retains data for 15 days
- '--storage.tsdb.retention.size=10GB' # Limits data retention to 10GB
Afterward, you will need to restart or recreate the service for the changes to take effect.
Other options you can find in Storage Docs.
That worked! Thanks for the answer.
I have this setup running on a normal Ubuntu server and the database has grown to several gigabytes in size.
How can I set the Prometheus database to only retain a certain time period of data and discard the rest? Is there a way to manually purge the database entries? I'm hesitant to just delete the files in the /Docker-Raspberry-PI-Monitoring/prometheus/data folder.