Grafana Table Filtering based on TextBox Dynamic Variable

Grafana version=Grafana v10.0.2
Operating system=Windows 11

Disclaimer - This is my third day learning about Grafana, I am a Super Beginner.

Problem Statement: I have certain type of logs that are stored in ElasticSearch. Each log has a unique identifier which is a hexadecimal characters. Currently I have managed to import the logs into Grafana and can visualize them using a Table Panel. I need to achieve the following - I need to have a Textbox to enter a search string. This string will generally be an ID and should match on the ID column of the table and filter the results(all logs with that id) based on the search string.

Approach -

  1. To achieve this I created a TextBox Dynamic Variable named “SearchID” and a Query Dynamic Variable named “QueryTable”. I want to write a query which filters all the tables entries and displays only the ones which have the same ID as the one in TextBox.
  2. In addition I also need to apply some regex in future on the TextBox field to have addional customization in the future(Not so important right now but would appreciate if anyone has any ideas for this)

Issue:
I want to add the textbox variable name in my query to enable this filtering but it doesn’t seem to work. I also looked up for Transformation for table panel, there were only 2 options - Filter by name and Filter by data value - but I dont seem to get the right options for filters using these two option.

Query (Dynamic Variable)
{
“query”: {
“bool”: {
“must”: {
“match”: {
“id”: “$SearchID”
}
}
}
}
}

Q) Are there any plugins for this? Am I missing something in my approach? Is my query correct?

PS: Any help is appreciated!

Welcome @roleyroley

What happens if you bypass the variable assignment in the query and do a raw query by adding the value of the parameter in the text box manually into the query?

1 Like

Hi @yosiasz Thanks you for your answer,

I tried the approach you suggested and figured that the Query dyamic variable was not having any effect on my Table panel, so instead I tried adding the textbox variable in the table’s query and it works!

Once again, thank you so much!

1 Like