Kapacitor: Add tag if condition is met

I want to add a tag to the input if the clusterName is X
So I did:
stream
// Select just the cpu measurement from our example database.
|from()
.measurement(‘cloudwatch_aws_ecs’)
|eval(lambda: “cluster_name” == ‘awseb-access-12345’).as(‘clusterType’)
|influxDBOut()
.database(‘telegraf’)
.retentionPolicy(‘autogen’)
.measurement(‘cloudwatch_aws_ecs’)

But it doesnt seem to work. How can I do this?

What is the tag you want to add?

See https://docs.influxdata.com/kapacitor/v1.3/nodes/eval_node/#tags and https://docs.influxdata.com/kapacitor/v1.3/tick/expr/#conditional-functions

Those should help you get it working.

2 Likes