Asier Gomez
Asier Gomez

Reputation: 6578

How to remove Grafana data periodically?

I have deployed Grafana monitoring system, it saves the databases on "/home/user/data" directory, the problem is that the data persists for ever so the filesystem is full usage and I would like to remove this data, for example weekly.

Upvotes: 4

Views: 11069

Answers (1)

Daniel Lee
Daniel Lee

Reputation: 7969

You do not say what data you would like to remove or what is generating all the data (it is logs?). It seems strange to just delete data from your database? Will your users not miss their dashboards?

I am going to assume you want to remove data from the database. There are a few ways to do this.

  1. Save a clean copy of the Sqlite database and then replace the database file once a week. This will lose all your data.

  2. For most data saved in the database, you could use the Grafana API to remove data.

    An example, would be to remove dashboards. With curl and basic auth:

    curl -X DELETE http://admin:admin@localhost:3000/api/dashboards/db/testdash

  3. Use the sqlite cli to write sql queries to delete data directly.

Upvotes: 2

Related Questions