Logstreem
Template variables

Template variables

One dashboard, every service — without duplicating it.

A variable is a placeholder the viewer picks from a dropdown. Reference it in LSQL with $name.

Definition
{
  "variables": [
    {
      "name": "service",
      "type": "query",
      "apl": "['api-gateway-prod'] | distinct service | order by service asc",
      "multi": true,
      "default": ["checkout"]
    },
    {
      "name": "env",
      "type": "static",
      "options": ["production", "staging"],
      "default": ["production"]
    }
  ]
}
Using them
read top to bottom
1['api-gateway-prod']
2| where service in ($service) and environment == $env
3| summarize p95 = percentile(latency, 95) by bin_auto(_time), service
4| order by _time asc
TypeOptions come from
queryAn LSQL query, refreshed with the dashboard
staticA fixed list you provide
textboxFree text the viewer types
intervalTime steps, for use in bin($interval)

Multi-select needs in, not ==

multi: true renders $service as a list, so service == $service breaks the moment someone picks two. Always write service in ($service) for a multi variable.