Can I use regular expression in Continuous Queries

influxdb

#1

As the doc show, a CQ must specify at least one measurement. I means, if we could build one CQ with regular expression to compact all measurement. I want to make CQ for every measurement. Can Influxdb support?


#2

I think you can. Take a look at the docs https://docs.influxdata.com/influxdb/v1.3/query_language/continuous_queries/ at section: Example 3: Automatically downsample a database with backreferencing

CREATE CONTINUOUS QUERY "cq_basic_br" ON "transportation"
BEGIN
  SELECT mean(*) INTO "downsampled_transportation"."autogen".:MEASUREMENT FROM /.*/ GROUP BY time(30m),*
END

It will create downsampled measurements in the downsampled_transportation database with exactly the same name as in the original database.


#3

This is close to what I need, but the field names are all appended with mean_. I’d like to be able to point my grafana graphs at the new retention policy without having to create all new graphs with the new field names.