InfluxDB query using regular expression is not working

时间:2019-04-17 01:40:40

标签: influxdb influxql

I am using InfluxDB and have below mention data in measurement against field "jkey"

/interfaces/interface[name='xe-1/0/4']/state/counters/out-queue[queue-number='0']/allocated-buffer-size
/interfaces/interface[name='xe-1/0/5']/state/counters/out-queue[queue-number='0']/allocated-buffer-size
/interfaces/interface[name='xe-1/0/4']/state/counters/out-queue[queue-number='0']/allocated-buffer-size

I am using below mention query which is working fine with above data.

select * from "measurement" where jkey =~ /interfaces\/interface.*/;

Now, i want to select only those records that have value 'xe-1/0/5' in it.

Below Query is also working fine as long as "[" is not part of query.

 select * from "measurement" where jkey =~ /name='xe-1\/0\/5']\/state\/counters\/in-pkts.*/ ;  

Wondering what i am missing to escape in below mention query?

select * from "measurement" where jkey =~ /interfaces\/interface[name='xe-1\/0\/5']\/state\/counters\/in-pkts.*/;

1 个答案:

答案 0 :(得分:0)

以这种方式转义可解决问题:

select * from "measurement" where jkey =~ /interfaces\/interface\[name='xe-1\/0\/5']\/state\/counters\/in-pkts.*/;