I have a template variable with the dropdown something like this -
data1, data2, data3, …data9, data10, data11, data12, data13, …data19, data20 and so on
When I select just one of this say data1, I get the desired result. But when I select 2 or more of this, say data1 and data10, I get the output for everything that starts with data1 like data1, data10, data11, data12, data13,… data19. How can I just get what I selected ?
Data source - influxdb
Query looks like instance =~ /$vm_id$/
No the example I showed was using InfluxDB same as you.
When I test regex it should not match on partial matches but only complete matches. The multi match regex grafana builds looks like this (data1|data20) (if data1 and data20 is selected). Which should be a full regex like =~/^(data1|data2)$/ (if you used the variable like=~/^$vm$/`
This does not match on partial matches. only data1 and data2 should be matched. Maybe a bug in your InfluxDB version? https://regex101.com/r/gSvxes/2
yes, here is my query
SELECT last(“value”) FROM “measurement” WHERE “type_instance” = ‘metric’ and host =~ /^$host_id$/ and instance =~ /^$vm_id$/ GROUP BY groupbyfactor
Did this problem ever get identified/fixed? I am having the same issue as the original poster. I am using Version 4.2 and influxdb 1.2 and am trying to use templating with regex and the multiselect
My data is setup with 128 fieldkeys with a naming pattern like this:
XXX_a, XXX_w, XXX_wh, XXX_dwh, YYY_a, YYY_w, YYY_wh, YYY_dwh, and so on. I am trying to filter out everything but the “_w” field keys.
My regex is this setup like this: /^(?!abc|._wh|._a|.*_dwh)/
and my query: SELECT mean(/^$current$/) FROM “energy” WHERE $timeFilter GROUP BY time(1m) fill(null)
The multiselect list has the correct fieldkeys listed, only items that end in “_w”. If I only select one item from the list everything works fine. But when I select multiple items the query also pulls the “_wh” field keys for all items selected but the last one.
XXX_w
XXX_wh
YYY_w
YYY_wh
ZZZ_w
I have also noticed it seems to be pulling in any fieldkeys that have a partial name match to one of the selected items. if I select items XXX_w and ZZZ_w I get the following returned.