Variables will allow you to apply filters on your dashboards and drilldown links. Grafana variables are indicated with a $.

Grafana variables

Add dashboard variables

Before you begin, you’ll need: Metrics in your Logz.io metrics account.

Add a new dashboard and variable
  • In Grafana’s left menu, click .
  • Click in the dashboard toolbar (upper right corner).
  • Select Variables > Add variable.

Add Grafana variables

Define the variable

Fill in the form, starting with the General section.

  • Give a short variable Name. This is the placeholder value this variable will use.
  • Set a human-readable Label. This is the filter control at the top of your dashboard.
  • In the Type list, choose Query.
  • We recommend leaving Hide empty.

Variable general settings

Next, fill in the query options.

  • For the Data source, select your Metrics account. (You can look it up here.)
  • We recommend setting Refresh to automatically occur On Dashboard Load.
  • The Query field is where things get really fun. Your query object should start with {"find": "terms"} and contain a field from your Elasticsearch index.

Variable query options

Your query can reference another Grafana variable. In this example, $cluster references another variable.

  {"find": "terms", "field": "kubernetes.node.name", "query": "cluster:$cluster"}

Otherwise, the query can be set to a specific field. For example:

  {"find": "terms", "field": "host.name"}
Configure the remaining options and save

The remaining options can be set to whatever makes the most sense for your metrics.

When you’re finished, scroll to the bottom of the page and click Update.

You’re now ready to use the variable in your new dashboard. If you’re looking to configure Explore in kibana drilldown links, click here.