Template Variable Types
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 & Widgets. 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
|