Our next-gen architecture is built to help you make sense of your ever-growing data. Watch a 4-min demo video!

Back to All Docs

Create & Manage Variables

Last Updated: May. 15, 2024

Overview

Variables act as placeholders for a value used in queries, making dashboards more interactive and dynamic. You can use variables instead of hardcoding specific names for servers, applications, or sensors in your queries. Once set up in Custom Dashboards, these variables allow you to switch between different data views easily. This flexibility is particularly useful for complex, high-cardinality metrics, enabling you to focus on specific values of interest across widgets for all data types, regardless of the variable source type.

Variable types

Choose from any of the following variable types:

Variable typeDescription
Static-value variableA static-value variable allows you to define the variable options manually. It contains a fixed list of values, such as a number or a string of numbers separated by a comma. For example, if you have country names that never change, you might want to create them as a static-value variable rather than a data source variable.
Query variableA query variable allows you to craft a data source query that returns lists of log, metric, or span values, metric names, metric labels, etc. For example, a query variable can generate a list of pod names, severity levels, or data centers, dynamically updating the values by fetching options via a data source query. Query variables prove beneficial when managing multiple data source instances, especially across diverse environments.

General setup

Getting started

Navigate to Dashboards > Custom Dashboards.

In a new or existing dashboard, click the variable icon { } in the upper right-hand corner of your dashboard.

You will be redirected to the variable setup section, where you will define each variable’s type and source, as well as its variable and display name.

Selection Options

Once you have defined your variable, you may choose from the Multi-value or Include all options.

  • Multi-value: Allows users to select one or more of the variable options presented at any time
  • Include all: All variable options are selected

When both options are selected, all of the variable options are selected by default and one or more may be deselected.

Opting out of both options will allow you to select one variable option at a time.

Create a static-value variable

STEP 1. Select static values as variable type.

STEP 2. Select the variable and display name.

STEP 3. Enter the variable values manually, separated by a comma.

STEP 4. Choose from the selection options and click SAVE.

Create a logs/spans query variable

STEP 1. Select query as variable type.

STEP 2. Select variable and display name.

STEP 3. For query options:

  • Select logs or spans as your source.
  • Select values as your variable type.
  • Define the field by selecting a log key you wish to query. The Values Preview will then display a list of current variable values.

STEP 4. Choose from the selection options and click SAVE.

Create a metrics query variable

Metric label values variable

STEP 1. Select query as variable type.

STEP 2. Select variable and display name.

STEP 3. For query options:

  • Select metrics as your source.
  • Select label values as variable type.
  • Select the metric and label name you wish to query.
  • Select one or more label filters for refining your label selections. Select filters to be included with the equal sign icon or to be excluded with the unequal sign icon. For example, if you have chosen pod name as your label name, you may choose to create a nested variable $.regionto filter your pods by region.

STEP 4. Select the values’ display name and actual value. The Values Preview will then display a list of current variable values.

STEP 5. Choose from the selection options and click SAVE.

Metric labels variable

STEP 1. Select query as variable type.

STEP 2. Select variable and display name.

STEP 3. For query options:

  • Select metrics as your source.
  • Select metric labels as your variable type.
  • Use the Metric Regex to filter the labels produced by your query.

STEP 4. Select the values’ display name and actual value. The Values Preview will then display a list of the field’s current variable values.

STEP 5. Choose from the selection options and click SAVE.

Metric names variable

STEP 1. Select query as variable type.

STEP 2. Select variable and display name.

STEP 3. For query options:

  • Select metrics as your source.
  • Select metric names as your variable type.
  • Use the Metric Regex to filter particular parts of the names produced by your query.

STEP 4. Select the values’ display name and actual value. The Values Preview will then display a list of the field’s current variable values.

STEP 5. Choose from the selection options and click SAVE.

Manage variables

Easily view and manage variables from the Custom Dashboards upper toolbar. You can rearrange the order of variables by dragging them.

Edit / Delete

To edit or delete a variable, select the variable display name to be rerouted to the variable setup. To delete, click on the trash icon.

Additional resources

Check out this instructional video to jump-start your variable setup.

Support

Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by emailing support@coralogix.com.

On this page