Skip to content

Instantly share code, notes, and snippets.

@unabridgedxcrpt
Forked from tingletech/gist:3995384
Last active February 1, 2018 19:21
Show Gist options
  • Save unabridgedxcrpt/a274776b636f5a555ed5cea8f4ea3427 to your computer and use it in GitHub Desktop.
Save unabridgedxcrpt/a274776b636f5a555ed5cea8f4ea3427 to your computer and use it in GitHub Desktop.
calculate transfer out from wowza logs
# To calculate the bandwidth usage per session, subtract sc-bytes in the “connect” event by sc-bytes in the “disconnect” event
connect=`grep $'\tconnect' wowzastreamingengine_access.log.????-??-?? | cut -f22 | awk '{total = total + $1}END{print total}' `
disconnect=`grep $'\tdisconnect' wowzastreamingengine_access.log.????-??-?? | cut -f22 | awk '{total = total + $1}END{print total}' `
SESSION=`expr $connect - $disconnect`
echo -e "Bandwidth usage per session, subtract sc-bytes in the *connect* event by sc-bytes in the *disconnect* event\n"
echo -e " $SESSION bytes"
# To calculate the bandwidth usage per stream, subtract sc-stream-bytes in the “play” event from sc-stream-bytes in the “stop” event.
play=`grep $'\tplay' wowzastreamingengine_access.log.????-??-?? | cut -f27 | awk '{total = total + $1}END{print total}' `
stops=`grep $'\tstop' wowzastreamingengine_access.log.????-??-?? | cut -f27 | awk '{total = total + $1}END{print total}' `
PERSTREAM=`expr $stops - $play`
echo -e "Bandwidth usage per stream, subtract sc-stream-bytes in the *play* event from sc-stream-bytes in the *stop* event.\n"
echo " $PERSTREAM bytes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment