Issue
Sometimes we need to analyze a Jetty request log quickly to see more about what is happening in a time series. Through the power of awk, we can see some data relatively quickly from the command line. This gives a per minute time series of average time in ms, total time taken across requests, max time and total number of requests during that minute.
Environment
Jetty, Linux
Resolution
This is an example querying about '/select' traffic through a component.
The fields output are the minute, avgTime, avgBytes, maxTime, totalCount:
cmd> grep '/select' jetty-2020_10_01.request.log | awk '{print $4, $NF, $(NF-1)}' | cut -c 14-17,21- | awk '{arr[$1]+= $2; b[$1]+=$3; count[$1]++; if ($2 > max[$1]) max[$1] = $2} END {for (key in arr) printf("%s\t%6.2f\t\t%6.0f\t\t%i\t\t%i\n", key, arr[key] / count[key], b[key] / count[key], max[key], count[key])}' | sort
00:00 55.78 121743 129 106
00:01 58.00 114417 181 101
00:02 60.98 141868 197 128
00:03 52.65 126631 104 96
00:04 57.03 129881 149 93
00:05 54.74 141087 107 122
00:06 55.64 139846 212 121
00:07 54.48 138532 129 120
00:08 53.48 119547 150 83
Comments
0 comments
Article is closed for comments.