Skip to content

Instantly share code, notes, and snippets.

@toodooleedoo
Created January 16, 2016 20:41
Show Gist options
  • Save toodooleedoo/b4993e693f944e294f60 to your computer and use it in GitHub Desktop.
Save toodooleedoo/b4993e693f944e294f60 to your computer and use it in GitHub Desktop.
#DATESTRING="20/Oct/2014";
REQUEST_LOG="request.log";
if [ -z "${DATESTRING}" ]; then
DATESTRING="`date '+%d/%h/%Y'`";
fi
for ((i=0;i<=9;i+=1)); do
printf "${DATESTRING} 0${i}: "
cat ${REQUEST_LOG} |grep -E "(ms)" |grep "<-" |grep "${DATESTRING}:0${i}" |sed -e 's/.*<-//g;s/.*-//g;s/ms//g;s/text\/html//g;s/.* //g' |awk "NR > 0 { s +=\$1 }; END {print s \" <- TIME TOTAL-> \" NR}" |awk '{print $1/$5}'
done;
for ((i=10;i<=23;i+=1)); do
printf "${DATESTRING} ${i}: "
cat ${REQUEST_LOG} |grep -E "(ms)" |grep "<-" |grep "${DATESTRING}:${i}" |sed -e 's/.*<-//g;s/.*-//g;s/ms//g;s/text\/html//g;s/.* //g' |awk "NR > 0 { s +=\$1 }; END {print s \" <- TIME TOTAL-> \" NR}" |awk '{print $1/$5}'
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment