Hello,
I’m a newbie and I would like some inputs for creating this query, I have this data:
Time ClientName
2024-04-05 14:11:41 VDI02
2024-04-05 13:53:41 VDI02
2024-04-05 14:34:10 VDI01
2024-04-05 14:11:40 VDI01
2024-04-05 13:53:41 VDI01
2024-04-05 14:11:40 PR-0145
And I would like to track given a timeframe how many Users are connected using this query:
from(bucket: “CITRIX”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “Citrix”)
|> filter(fn: (r) => r._field == “ClientName”)
|> distinct(column: “_value”)
|> count()
|> rename(columns: {_value: “Users”})
|> map(fn: (r) => ({hour: r._start, Users: r.Users}))
But that only gives me a result of all users connected on a given timeframe, instead of a series of count() for a given timeframe.
Results of the query:
hour Users
2024-04-04 09:18:19 3
Expected results:
hour Users
2024-04-04 13:00:00 2
2024-04-04 14:00:00 3
Any advice on how to map this result for every hour?