Variables are placeholders for values. You can use variables in query statements. You can use variables to create dashboards that are more interactive and dynamic.

Configuration description

If you configure a variable in a drill-down event or a filter, you must add the variable to the query statement. The variable is in the ${{Variable name|Default value}} format. For example, you can configure host=~"${{host|^.*}}" for host=~"^.*".

  • Drill-down events

    If you specify Dashboard A when you configure a drill-down event for a different chart, you can click a value in the different chart to access Dashboard A. If you specify a variable when you configure the drill-down event for the different chart and the variable is named the same as a variable for the current chart, the value that you click to access Dashboard A is used to replace the variable for the current chart. The system uses the value to re-execute the query statement for the current chart, and the chart data is updated. For more information, see Drill-down events.

  • Filters

    If you add a filter of the Replace Variable type on a dashboard and the dashboard contains a chart whose query statement includes the variable specified for the filter, the system automatically replaces the variable in the query statement for the chart on the dashboard with the value that you specify for the filter. The variable configuration applies to all charts whose query statements include the variable on the dashboard. For more information about how to add a filter of the Replace Variable type, see Add a filter of the Replace Variable type.

Configuration example

In the following query statement, the value of the request_method field is an asterisk (*). Change the asterisk (*) to the ${{method|PUT}} variable.
request_method: * | SELECT __time__ - __time__ %60 AS time, COUNT(1) AS PV GROUP BY time ORDER BY time
Placeholder variable