Menu
Documentationbreadcrumb arrow Grafana Cloudbreadcrumb arrow What's new in Grafana Cloudbreadcrumb arrow Loki data source improvements: "or" filter syntax, filter by label types, derived fields by labels
Grafana Cloud
← Back to What's new
Generally AvailableData sourcesLogs
Release date: 2024-01-05

Loki data source improvements: "or" filter syntax, filter by label types, derived fields by labels

Introducing several improvements to the Loki data source.

Line filter “or” syntax

Loki’s line filter syntax is great to find specific substrings of your log lines. If users want to find multiple different substrings it was cumbersome to use the regex =~ operator. With this change it is possible to chain multiple strings with the existing filter operators.

Example:

{app="foo"} |= "foo" or "bar" != "baz" or "qux"
Filter based on label type

Grafana users can use the action buttons in the log details to filter for specific labels. Those would be always added as a LabelFilter expression regardless of the type of the label. Now, filtered labels will be added either to the stream selector if the label is an indexed label, or as a LabelFilter expression if the label is a parsed label or part of structured metadata.

Derived fields based on labels

Derived fields or data links are a concept to add correlations based on your log lines. Previously it was only possible to add derived fields based on a regular expression of your log line and doing it based on labels was not possible. With this change derived fields can be added either based on a regex of a log line or based on a label, parsed label or structured metadata.

The following example would add the derived field traceID regex based on a regular expression and another app label field based on the app label.

Derived fields based on labels