Skip to content

Commit

Permalink
Update Loki.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lwindolf authored Aug 7, 2024
1 parent ccdae40 commit 785ef0f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Cheat Sheets/kubernetes/Loki.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<exception>\\w+Exception: [^\"]+)"
| label_format exception=`{{ .exception }}`

0 comments on commit 785ef0f

Please sign in to comment.