i have an InfluxDB 2 instance and am storing data like this:
_time _value hostname system username
2023-08-10 15:36:01 1234 host1 PRD mueller
2023-08-10 13:11:01 5541 host1 TST mueller
2023-08-10 11:33:01 1234 host1 PRD mueller
2023-08-09 13:32:01 2234 host1 PRD mueller
2023-08-09 10:46:01 3334 host1 PRD mueller
Now i want a simple graph showing the amount of entries in this measurement per day:
2023-08-10 => 3
2023-08-09 => 2
Currently i try with following flux query:
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “crashes”)
|> aggregateWindow(every: 1d, fn: count)
|> yield(name: “count”)
As a result i get in Graphana for each day a time of 02:00 added, so 2023-08-12 02:00 is have a value of 3 (but this is already the next day) → is this normal?
Is my query wrong?
Also if i query for last 30 days it is “ok” (with the above +2 hours). but if i query for last 90 days data is missing (see attachments)
I’m not sure why data isn’t appearing if you extend the stat time. That doesn’t make any sense. Have you tried querying with the InfluxDB UI or API to verify if the query is the problem?
The time added seems like a timezone issue.
Flux returns data in UTC.
You might want to look at this post
It might have to do something with the way Grafana is visualizing the time vs the time you queried.
Based off your data your query looks great.
i think i found the “problem” but still need a solution.
I exported all data from measurement using the command:
"influxd inspect export-lp --bucket-id 12345 --engine-path PATH_TO_ENGINE --measurement myMeasurement --output-path D:\temp\data.lp
If i now look at the data, i can see that some fields have an i (the newer ones) and others just have an integer. Might this be a problem showing all data in a graph?
How can i solve it?
crashes_temp,hostname=host1,stage=TST,username=user1,version=6.422.12.0 duration=2176 1628065333000000000
crashes_temp,hostname=host11,stage=ABC,username=user2,version=6.422.12.0 duration=18434i 1692097086000000000
crashes_temp,hostname=host12,stage=GRU,username=user3,version=6.422.12.0 duration=125i 1692101211000000000