I have an InfluxDB database that is ingesting metrics from Telegraf.
These metrics come from both production and non-production systems, and vary from system metrics to application metrics. The data has different retention requirements, and we’ve avoided setting a policy up.
The problem I run into is moving staging systems to point to a non-default retention policy would require our Grafana dashboards to switch between specifying a retention policy and not when querying to display data, depending on whether the system is a staging system or production.
To start, I want to delete all staging data older than approximately 6 months. I’m thinking of setting this up as a cron job and calling it a day.
USE metrics;
DELETE WHERE "service_class" =~ /^[staging|testing]/ AND time > now() - 26w;
Is this a bad idea? The limitation of non-default retention policies that you have to specify the policy name in SELECT queries makes it undesirable to us.