Created
March 31, 2017 11:14
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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