From 785ef0fa63045f47fa3ed3a2b18d8d671cae4740 Mon Sep 17 00:00:00 2001 From: Lars Windolf Date: Wed, 7 Aug 2024 17:00:21 +0200 Subject: [PATCH] Update Loki.md --- Cheat Sheets/kubernetes/Loki.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Cheat Sheets/kubernetes/Loki.md b/Cheat Sheets/kubernetes/Loki.md index d6c0df191..0c7390678 100644 --- a/Cheat Sheets/kubernetes/Loki.md +++ b/Cheat Sheets/kubernetes/Loki.md @@ -12,3 +12,9 @@ Reduce log lines to exception names (without regex for Loki <2.4) {label="match"} |~ "Exception:" | json | line_format `{{ regexReplaceAll ".*\\s+(\\S*Exception):.*$" .message "${1}" }}` +Extract a text part into a label for example exceptions: + + {kubernetes_namespace_name="my-namespace-1"} + |= `Exception:` + | regexp "(?P\\w+Exception: [^\"]+)" + | label_format exception=`{{ .exception }}`