Skip to content

Instantly share code, notes, and snippets.

@navono
Last active August 3, 2020 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navono/23b4f678d4d732a9d741853c09371c49 to your computer and use it in GitHub Desktop.
Save navono/23b4f678d4d732a9d741853c09371c49 to your computer and use it in GitHub Desktop.
filter zap json logger with jq

suppose we have a log file named 'log.json' and record some error level info, we want to split the stack trace from the file with some filter(like time) to formatted json, so we can do this :

cat log.json | jq '. | select(.level=="error") | select(.time | contains("xxxxx"))' | jq '.stacktrace | fromjson'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment