Grafana variables - custom query to inject my dynamic query

  • What Grafana version and what operating system are you using?
    Grafana cloud Pro (Grafana v10.2.0-59542pre)

  • What are you trying to achieve?
    Dynamic panel query using custom variable

  • How are you trying to achieve it?
    using custom query with key values in the context of grafana variables.

  • What happened?
    The value from the key in the custom variables is not placed in the query as expected.

  • What did you expect to happen?

I have a a predefined variable (text box) named traceId.

I created a custom variable name services with the billow key value
key: get-traces
value: /group/find/all/${traceId}/

example record from the logs:

In my logs panel query i was expected to filter all the logs using this query when i type in my predefined variable “YTE27369”

{env=“$env”, app=“$app”, filename=~“$filename”, http_method=“POST”} | json | http_url =~ .*$services

It look like the query not parsing the values /group/find/all/${traceId}/ when i select get-traces from services variables.

  • Did you follow any online instructions? If so, what is the URL?
    Didn’t find any.

Query inspector

Expr: {env=“dev”, app=“apple”, filename=~“/log/audit.log”, http_method=“POST”} | json | http_url =~ .*/group/find/all/\\$\\{traceId\\}/