Tag values with time range

Viewed 3383

Is there any way to retrieve the TAG values with time range?

SHOW TAG VALUES FROM test WITH KEY = "name" WHERE time > NOW() - 12h

The above query returns even the 3 day old tag values for which there is no record inserted in the last 12 hours.

1 Answers

You can not query tags with where. I think accepting where for show tags is a minor bug of the InfluxQL parser. The reason is that tags are stored as indexed values and there is no quick way to answer your request (and show tags values assumed to be fast).

If you really want, you can try this hack (it's require a grind through database, so it's slow):

select name,last(some_value) from test  where time > NOW() - 12h group by "name".

To make it work you need provide at least one field name (which you may ignore later). It's a limitation of Influx, you can't do queries on tags only.

Related