Skip to content

Commit

Permalink
Update Loki.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lwindolf authored Jul 12, 2024
1 parent a9e16bd commit 5ff9afd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Cheat Sheets/kubernetes/Loki.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Convert log string to json

Reduce log lines to exception names

{label="match"} |~ "Exception:" | json | line_format `{{ regexReplaceAll ".*\\s+(\\S*Exception):.*$" .message "${1}" }}`
{label="match"} |~ "Exception:" | json | regex(.message, '.*\\s+(\\S*Exception):')

Reduce log lines to exception names (without regex)
Reduce log lines to exception names (without regex for Loki <2.4)

{label="match"} |~ "Exception:" | json | line_format `{{ regexReplaceAll ".*\\s+(\\S*Exception):.*$" .message "${1}" }}`

{label="match"} |~ "Exception:" | json | regex(.message, '.*\\s+(\\S*Exception):')

0 comments on commit 5ff9afd

Please sign in to comment.