Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show InfluxDb tags only for todays date?

I am having trouble getting this query in InfluxDb to work properly. Wondering if someone can help.

I want to show tag values but only for the current days data. I have this

SHOW TAG VALUES FROM table WITH KEY = "name"

This list shows all values from the full measurement. I want to only show values for data that was inserted today.

I've tried

  SHOW TAG VALUES FROM table WITH KEY = "name" where date='2018-10-23'
  SHOW TAG VALUES FROM table WITH KEY = "name" where time='2018-10-23'

as well as some other variations but can't seem to get this right. Does anyone know how to properly form this query?

I am using this as a variable inside Grafana.

Thanks

like image 956
Roni Hoffman Avatar asked Jan 22 '26 02:01

Roni Hoffman


1 Answers

how about use subquery? instead of "show tag values" like this

# show tag values from with key = “TAGName” where condition
select TagName from (select field, TagName from Measurement where condition)

it return timestamp with tag values

like image 154
Merturl Avatar answered Jan 23 '26 19:01

Merturl