I am just working on transferring some CQs from InfluxDB to Kapacitor.
The original working CQ is this:
CREATE CONTINUOUS QUERY "ds.1h"
ON ninatest
RESAMPLE EVERY 1h FOR 1h
BEGIN SELECT sum(*)
INTO ninatest.autogen.:MEASUREMENT
FROM ninatest2.autogen./.*/
GROUP BY time(1h), *
END
The tick is this (for test reasons a batch for now and period set to 1min):
dbrp "ninatest2"."autogen"
batch
|query('SELECT sum(*) FROM "ninatest2"."autogen"./.*/')
.period(1m)
.every(1m)
.groupBy(*)
|influxDBOut()
.database('ninatest')
.retentionPolicy('autogen')
.measurement(:MEASUREMENT)
.precision('s')
Issue:
When I enable the task for this tick script it get the following reply:
invalid TICKscript: parser: unexpected unknown state, last char: ā:ā line 11 char 22 in āasurement(:MEASUREMEā. expected: ānumberā,āstringā,ādurationā,āidentifierā,āTRUEā,āFALSEā,"==","(","-","!"
I also tried
.measurement(/.*/)
with the error:
invalid TICKscript: line 11 char 10: error calling func "measurement" on obj *pipeline.InfluxDBOutNode: reflect.Set: value of type *regexp.Regexp is not assignable to type string
.measurement(/.*/)
with the error:
invalid TICKscript: parser: unexpected . line 11 char 22 in "asurement(.*)". expected: "number","string","duration","identifier","TRUE","FALSE","==","(","-","!"
I understand, that there are errors, since a string is expected.
How can I use backreference for the measurement name? I have quite a couple of measurements which change dynamically and cannot write a rule for every single one.