Template Expressions

LogScale template expressions are little pieces of code which define how to access and use a variable that is available e.g., in a given dashboard.

These expressions have a special Template Syntax inspired by popular programming frameworks which also use template expressions.

In LogScale, you can use language expressions in parts of the UI where the template language is adopted, such as in Dashboard Interactions or when adding a new custom link column in fields (see Adding & Removing Fields).

In these cases, you write your expressions in dedicated text boxes available in the UI (e.g., Title template, URL template boxes).

An expression is valid when written inside a string of characters started by {{ and ending with }}. Everything in between the pair of opening and closing curly braces will be evaluated as an expression.

For example, writing {{ startTime }} will extract the value from the variable named startTime and inject it into the string, replacing the template expression — see some examples of how this is done at Template Variable Types.

Template Syntax

You can use two different accessors to write variables in expressions:

  • Dot notation — write fields followed by a ., followed by the name of the field you want to use. For example:

    {{ fields.dayOfWeek }}

  • Bracket notation — write fields followed by the name of the field in square brackets. This is a more verbose but flexible accessor that you can use for cases when field names contain special characters, for example a \ character:

    {{ fields["strange\"fieldName\""] }}