Can I use regular expression in Continuous Queries



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?


I think you can. Take a look at the docs at section: Example 3: Automatically downsample a database with backreferencing

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

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


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.