SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


apacheaccesslog
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

apacheaccesslog [2013/03/26 20:58] (current)
sjoerd created
Line 1: Line 1:
 += Apache Access Log Analysis =
  
 +This is a small howto on how to analyze the amount of data requests for a webserver using the access log.
 +
 += Location Access Log =
 +
 +<​code>​
 +/​var/​log/​apache2
 +</​code>​
 +
 += Preparing Access Logs =
 +If you need older logs as well, you'll need to unpack them. They are zipped using bzip. Uncompressing them is done like this:
 +
 +<​code>​
 +bunzip2 access_log-20101226.bz2
 +</​code>​
 +
 += Analyzing The Log =
 +
 +This is the command to get the requests per minute from the access log. The last sorts on the amount of requests per minute:
 +<​code>​
 +cat access_log | awk '​{gsub("​\\[",""​);​ split($4,​a,":"​);​printf("​%s:​%s:​%s %s\n",​a[1],​a[2],​a[3] ,$1)}' | sort | uniq -c | sort -nk1,1
 +</​code>​
 +
 +{{tag>​apache security scripts}}
apacheaccesslog.txt ยท Last modified: 2013/03/26 20:58 by sjoerd