[InfluxDB] [1.7.9] Purge old data manually

Hi Community,

I’m using an InfluxDB 1.7.9, filled of data, without any retention policy.

Now, i’d like to manually cleanup old data by deleting data older than one year but keeping one monthly metric in those (basically, after one year, I keep only one data point per month per series).
What is the best way to do ?
If not possible, can I do an full purge like DELETE * WHERE time < '2019-06-29'

Once done, I thing it’s possible to do that automatically using an retention policy. I’ve dig an bit the docs but i’m worrying to create mess. Could someone help me to explain the how-to.

Could be basic for you but i’m an influxdb newbies, so thanks for your understanding :wink:

Rgds,

Hello @Thierry,
Welcome!

You’ll want to use a combination of Retention Policies and Continuous Queries.
You can automatically delete expired data with a Retention Policy:
https://docs.influxdata.com/influxdb/v1.8/guides/downsample_and_retain/
You can downsample data two a monthly resolution with continuous queries.
https://docs.influxdata.com/influxdb/v1.8/query_language/continuous_queries/
Let me know if you need more help!

Thanks,
Anais

Hi @Anaisdg,

Thanks for your quick reply.
If i’m right, setting the retention policies and continuous query will not purge data older than the one grab before setting of the retention policy, right ?

Thanks

Hello @Thierry,
Yup that’s correct for continuous queries, but not for retention policies.