Grafana version 11.1
I am trying to have the selection of one variable narrow the results for the second variable. I am trying to accomplish this by “linking” the two variables. It looks like this was possible when you could manually enter a Query in the variable editor but I am unable to do that in the latest version.
You can see in the attached image that I have a server variable and a site variable. I would like to be able to select the server and have the Site variable show only the sites that are connected to that selected server.
We are using Loki.
I attached a screenshot of the Site variable configuration to show the inability to enter the Query manually.
I have researched online like crazy but everything references entering the query manually in the variable which is not there.
I guess you want to set Stream selector
(that’s your “query”), e.g.{server="$server"}
Yes, I should have given more background. We are using Loki with Nlog for our application logging. The idea is to utilize Grafana to put all of our various customer logs into one location. I wanted to create one dashboard to view the logs but filter them down to each individual site. The issue is that we have tons of sites on different servers so the “Sites” list is rather long. That is why I was hoping to filter the “Sites” list based on which “Server” the user selects.
That’s exactly the idea which I gave you. Of course it is not copy&paste, because you didn’t provide all details - e.g. your labels in Loki, server variable definition, so just change it for your case.
I am sorry, still new to Grafana. I tried entering server=“$Server” into the Stream Selector but I am getting a syntax error when I try to save.
Below is what my query currently looks like on the dashboard.

Please use formatted texts, not images.
It’s is stream selector, not LogQL query, so only {server="$Server"}
. It doesn’t make sense to add more labels into selector. Follow native user flow:
1.) User selects Server variable
2.) Grafana will regenerate “Site” values, so only {server="$Server"}
3.) User selects Site variable
4.) Grafana will regenate “Log_Type” values, so selector should contains all selected variables before: {server="$Server", app="$Site"}
…
2 Likes
Fantastic!!! Thank you very much for your help. It is doing exactly what I want now.