kapacitor
kapacitor copied to clipboard
Generate random ID for influxdbOutNode
Is there a way to generate a random ID through a lambda function or anything of the sort? Something Like
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag('alertName', name)
.tag('triggerType', triggerType)
.tag('acked', 'false')
.tag('location', 'Building 1')
.tag('id', rand.Intn(100))
There was an issue raised about this before but no answer. Any suggestions?
Currently there isn't a way to make a random number. We really should have one.
Yeah it would definitely be beneficial. I am pushing all of the alerts to an Influxdb instance and need a way to delete them. It would be much easier to be able to delete if we get generate a random UUID for each alert. Maybe coming soon? Fingers crossed.
https://github.com/influxdata/kapacitor/pull/2680
Awesome! So in the example, it would be something like:
|influxDBOut() .create() .database(outputDB) .retentionPolicy(outputRP) .measurement(outputMeasurement) .tag('alertName', name) .tag('triggerType', triggerType) .tag('acked', 'false') .tag('location', 'Building 1') .tag('id', rand())
?