Skip to content

Instantly share code, notes, and snippets.

@mariogasparoni
Last active May 27, 2021 14:38
Show Gist options
  • Save mariogasparoni/a94a39d02960258d2abdc0a79f74d8ff to your computer and use it in GitHub Desktop.
Save mariogasparoni/a94a39d02960258d2abdc0a79f74d8ff to your computer and use it in GitHub Desktop.
BBB's HTML5 client log viewer
#!/bin/bash
#antobinary's script to view html5 client log (NGINX '/var/log/nginx/html5-client.log' file)
#Usage: ./bbb-html5log-viewer.sh <LOG_FILE>
FILE=$1
if [ -z `which jq` ]
then
echo 'jq not found - you must install jq:'
echo ' sudo apt-get install jq'
exit 1
fi
if [ ! -f $FILE ]
then
echo "Error - could not open LOG_FILE."
echo " Usage: ./bbb-html5log-viewer.sh <LOG_FILE>"
exit 1
fi
#old 2.2
#sed -u -e 's/\\x22/"/g' -e 's/\\x5C/\\/g' -e 's/\\x\([0-9A-F][0-9A-F]\)/\\\\x\1/g' $FILE | awk '{$1=$2=""; print $0}' | sed -e 's/^\s*//g' -e '/^-.*/d' | jq
sed -u -e 's/\\x22/"/g' -e 's/\\x5C/\\/g' -e 's/\\x\([0-9A-F][0-9A-F]\)/\\\\x\1/g' $FILE | sed -e 's/^\s*//g' -e '/^-.*/d' | jq '.nginx | select( .request_body != "") | .request_body | fromjson '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment