Count requests from access log for the last 7 days

Posted by RoboForm on Server Fault See other posts from Server Fault or by RoboForm
Published on 2013-10-17T20:03:03Z Indexed on 2013/10/17 21:58 UTC
Read the original article Hit count: 188

Filed under:
|
|

I would like to parse an access log file and have returned the amount of requests, for the last 7 days. I have this command

cut -d'"' -f3 /var/log/apache/access.log | cut -d' ' -f2 | sort | uniq -c | sort -rg

Unfortunately, this command returns the amount of requests since the creation of the file and sorts it into HTTP-code categories. I would like just a number, no categories and only for the last 7 days.

Thanks.

© Server Fault or respective owner

Related posts about apache2

Related posts about logging