'Clear old data in Grafana

I'm using Prometheus and Grafana for monitoring the servers. Grafana data were stored in /home/user/data folder.

This folder occupied the majority of the file system .

Need to remove the old data in Grafana data folder ( Data which is older than a month )



Solution 1:[1]

Grafana does not save data from Prometheus. It queries Prometheus and displays UI. In this case, you would have to look at purging Prometheus data.

Prometheus by default has a 15 day retention period. But this could be adjusted by the -storage.local.retention flag to suit your needs.

Solution 2:[2]

According to official documentation of Prometheus:

--storage.tsdb.path: This determines where Prometheus writes its database. Defaults to data/

--storage.tsdb.retention: This determines when to remove old data. Defaults to 15d

If your Grafana's datasource is prometheus, you can stop prometheus, delete content of this path, start prometheus again and restart grafana If you have data for more than 15 days, then you set storage retention. reducing it to less value will delete the data before the specified time.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Xavier Guihot
Solution 2 Community