Pavol Bujna
Pavol Bujna

Reputation: 179

Grafana Regex fiter by name

These are iPads and phones with their battery levels monitored in Grafana. How can I filter it, so it will show me the iPads only (starting with device name "H.") When I try regex like "/^H.$/" it doesn't work.

Thanks

grafana

error

Upvotes: 0

Views: 13582

Answers (1)

dnnshssm
dnnshssm

Reputation: 1315

Not a regex expert, but ^H.$ will only match H. literally.

You need to match any amount and type of possible following characters as well; you can do that for numbers, lowercase, and uppercase characters with \w*.

So in your case, ^H.\w*$ should work.


EDIT

After having a closer look at your pictures, I realize that the names you want to filter for are rows of the column device_name, not the column names themselves. However, the used Filter by name filters the column names, in your case device_name and battery_level. Since neither fit the regex, 'No data' is returned.

To filter the results of a column you have to use Filter data by values. You have to specify the field, i.e. the column device_name, use Regex as type for Match and then enter the regex in the Value field.

Use the regex as explained above.

Upvotes: 1

Related Questions