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 }}`