Hi, i’m try to filter query data by part of tag value. Extract host part of FQDN and compare with string/variable.
import "strings"
from(bucket: "vCenter")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "vsphere_vm_cpu")
|> filter(fn: (r) => r["_field"] == "usagemhz_average")
|> filter(fn: (r) => strings.substring(end: strings.index(substr:"." , v:r.guesthostname ), start:0 , v:r.guesthostname ) == "ada")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
after this query stop with “panic: runtime error: slice bounds out of range [:-1]”
I use influxdb 2.1.1
What am I doing wrong ?