Hello
i am trying to do a simple query but don’t know how to.
i only need the last tag value and their timestamp in date/time format
Hello
i am trying to do a simple query but don’t know how to.
i only need the last tag value and their timestamp in date/time format
Hello @Vhailor,
Welcome! Sorry for the delay, sometimes questions get buried. Feel free to tag me in the future or bump your question. Are you using InfluxQL or Flux?
To query for last value you can use the last function:
InfluxQL:
SELECT LAST(<field_key>)[,<tag_key(s)>|<field_keys(s)>] [INTO_clause] FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] [SLIMIT_clause] [SOFFSET_clause]
Flux:
from(bucket: "Website Monitoring Bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> last(column: "_value")
Does this help? Or am I misunderstanding your question? Please let me know.
Thanks
yes, i am working on flux.
tried your sample but i don’t get the last value, i need to show the last tag “colada”, but i dont insert colada in all query’s, only when i have a value for it.
thanks in advance @Anaisdg
Hello @Vhailor,
Can you please try increasing your query range to include a time when the colada tag is written/when you have a value for it?
You also might want to try filtering for that tag too.