From df204a9563a842a9837fbe67e03cca07ae0482fc Mon Sep 17 00:00:00 2001 From: Sven Grossmann Date: Tue, 9 Jan 2024 16:07:04 +0100 Subject: [PATCH] Loki: Add documentation for `label` derived field (#80218) --- .../datasources/loki/configure-loki-data-source.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/sources/datasources/loki/configure-loki-data-source.md b/docs/sources/datasources/loki/configure-loki-data-source.md index 81ec007efbe..bae45a99498 100644 --- a/docs/sources/datasources/loki/configure-loki-data-source.md +++ b/docs/sources/datasources/loki/configure-loki-data-source.md @@ -91,9 +91,9 @@ To troubleshoot configuration and other issues, check the log file located at `/ ### Derived fields -Derived Fields are used to extract new fields from a log message and create a link from the value of the field. +Derived Fields are used to extract new fields from your logs and create a link from the value of the field. -For example, you can link to your tracing backend directly from your logs, or link to a user profile page if the log line contains a corresponding userId. +For example, you can link to your tracing backend directly from your logs, or link to a user profile page if the log line contains a corresponding `userId`. These links appear in the [log details][]. You can add multiple derived fields. @@ -106,7 +106,11 @@ Each derived field consists of the following: - **Name** - Sets the field name. Displayed as a label in the log details. -- **Regex** - Defines a regular expression to parse a part of the log message and capture it as the value of the new field. Can contain only one capture group. +- **Type** - Defines the type of the derived field. It can be either: + + - **Regex**: A regular expression to parse a part of the log message and capture it as the value of the new field. Can contain only one capture group. + + - **Label**: A label from the selected log line. This can be any type of label - indexed, parsed or structured metadata. The label's value will be used as the value of the derived field. - **URL/query** Sets the full link URL if the link is external, or a query for the target data source if the link is internal. You can interpolate the value from the field with the `${__value.raw}` macro.