Skip to content
This is an archived version of the documentation downloaded from LogScale Documentation Archives. Up to date documentation, and documentation for later versions, is available on LogScale Documentation

## Template Variable Types

The LogScale Template Language supports three distinct types of variables: context variables that are available within specific environments like Dashboards, field variables that are derived from query results, and parameter variables that come from Dashboard Parameters. Each variable type has its own syntax for access and usage, with context variables using direct names (e.g., startTime), field variables requiring the 'fields' prefix, and parameter variables using the 'parameters' prefix to retrieve their values.

In the LogScale Template Language, variables can be grouped into three categories: context, field or parameter variables.

### Context Variables

Available within a specific context, such as in Dashboards. The names of context variables are static, meaning, e.g. `startTime` and `endTime` will always be available as variables in a Dashboard context.

Variable Name | Value
--- | ---
`startTime` | `1675668087812`

To use this variable in an expression, simply write the name of the variable e.g. `startTime` :

Template Expression | Result
--- | ---
`Time in millis: {{ startTime }}` | `Time in millis: 1675668087812`

### Template Field Variables

Derived from the fields in the query result. Which field variables are available depend solely on the fields in a query result.

Example of a field variable name and its value:

Field Name | Value
--- | ---
`dayOfWeek` | `Monday`

To use this variable in an expression, write `fields`, followed by a dot or a bracket (see Template Syntax for a definition of these accessors) and then the name of the variable e.g. `dayOfWeek`:

Template Expression | Result
--- | ---
`Today is {{ fields.dayOfWeek }}` | `Today is Monday`

### Template Parameter Variables

The parameter variable is the parameter value derived from Dashboard Parameters.

The parameter variable inserts the value of the specified parameter, it can insert the value of any parameter that is configured on the dashboard.

Example of a parameter variable name and its value:

Parameter Name | Value
--- | ---
`repository` | `humio`

To use this variable in an expression, write `parameters`, followed by a dot or a bracket (see Template Syntax for a definition of these accessors) and then the name of the parameter e.g. `repository`:

Template Expression | Result
--- | ---
`Selected repository: {{ parameters.repository }}` | `Selected repository: humio`

#### Enter search term