Host Tag for last 5 min

We are using docker in our production with ec2 autoscaling, now docker container is being created and terminated frequently so this create a huge list of host which are terminated. so i wanted to execute a query where only host for last 5 min would show. some thing like

show tag values with key = “docker_host” WHERE time > now() - 5m

@Amit_Kumar_Singh,

Would something like this work for you?

SELECT mean("n_containers") AS "mean_n_containers" FROM "telegraf"."autogen"."docker" WHERE time > now() - 5m AND "host"='Anais.attlocal.net' GROUP BY time(:interval:) FILL(null)

I approached a different method, i used a series kapacitor task to dump data from autogen to another retention policy with 3 hour duration.

when i tested for sample data it worked but when i used same script for production it is not sending any data to new retention policy.

below is the script.

stream
|from()
.database(‘telegraf’)
.groupBy(*)
|window()
.period(5m)
.every(5m)
.align()
|influxDBOut()
.database(‘telegraf’)
.retentionPolicy(‘three_hours’)