Hey all,
I am new to time series data and very new to Influx, but really excited about v2 OSS. I’m sure there is a simple way to do this but I have not been able to find a solution in the past few days.
Data:
_field = ‘ip’ where _value is the ip address
_field = ‘10sec’ where _value is bytes
I’ll outline what I’m trying to accomplish:
- take ‘ip’ and reduce it to distinct [or unique?] values
- Sum ‘10sec’ per those distinct values in ‘ip’
- Ideally this query would also have a window function to sum ‘10sec’ on ‘ip’ criteria each hour for the past 12 hours. Or something like that, but just getting items 1 & 2 would be great.
So the result would be total bytes transmitted by ip each hour.
I have been able to get the distinct values for ‘ip’, but I am having a terrible time trying to sum.
import "influxdata/influxdb/schema"
from(bucket: "monitor")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_field"] == "ip")
|> schema.fieldsAsCols()
|> distinct(column: "ip")
I apologize in advance if I am not using the correct terminology. Let me know if I can provide any additional context.
Thank you!