Skip to content

Instantly share code, notes, and snippets.

@Velrok
Created March 31, 2017 11:14
Show Gist options
  • Save Velrok/90c102702fe909da4a45d4923e1014d2 to your computer and use it in GitHub Desktop.
Save Velrok/90c102702fe909da4a45d4923e1014d2 to your computer and use it in GitHub Desktop.
Piple the logs of an app into follow_json_logs. If the message is json it will pretty print it. Optionally parse a jq query as a first argument.
function follow_json_log {
if [ -n "$1" ]
then
jq -R "fromjson? | select (type == \"object\") | $1"
else
jq -R 'fromjson? | select (type == "object")'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment