Tuesday, September 23, 2014

Command for computing max number of requests per second

 cat access_log.2014-09-23.txt | awk '{print $4}' | sort | uniq -c | sort -n

(assuming $4 is the timestamp)

per hour (sorted on hour):
cat access_log.2015-02-08.txt | awk '{print substr($4,14,2)}' | sort | uniq -c | sort -n -k2

List of IPs with number of requests in a particular hour(15) :
 cat access_log.2015-03-09.txt | awk '{if('15' == substr($4,14,2)) print $1}' | sort | uniq -c | sort -n

Blog Archive