Obtain requests per second through log file analysis

chris (2011-03-07 11:21:14)
879 views
0 replies

This is a unix/linux one-liner for figuring out requests per second from a NCSA-formatted log file (eg Apache web logs). This could easily be moved into excel, gnumeric or gnuplot for graphing purposes. I'm really just noting this down for my own benefit - but hey, you might find it useful too.

$ sort -b -k4.9,4.12 -k4.5b,4.7Mb -k4.2,4.3 -k4.14,4 logfile.txt | \
awk -F '[ [/:]' '{print $7"-"$6"-"$5":"$8":"$9":"$10}' |\
xargs -I . date -j -f "%Y-%b-%d:%T" "+%s" .|sort| \
uniq -c|awk '{print $2, $1}' > datafile.txt

christo


Digg it! Submit to Slashdot Add to Blinklist Del.icio.us Add to Newsvine Add to Technorati Add it to Google Bookmarks
comment