Membership Membership:
Latest New User Latest: vpros
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 137

People Online People Online:
Visitors Visitors: 54
Members Members: 0
Total Total: 54

NakedMCSE Computer Tech Support Forums

So you have passed all of the exams and you are now out in the real world of windows servers, linux servers and freebsd servers faced with a tech support problem you have never seen before...

Find free online tech support in the forums below, respecting that advice is free, but work beyond advice is not...

The General forum is provided for off topic discussion.

You need a user account to post - please Register or Login.

Online Tech Support Forums
 
  Forum  Open Source Tec...  Apache Server  Parsing Apache logs to see what users downloaded a file in a certain time period
Previous Previous
 
Next Next
New Post 12/23/2011 12:33 PM
Informative
  Walker
119 posts
www.lairdscomputer.com
10th Level Poster


Parsing Apache logs to see what users downloaded a file in a certain time period 

 The following is a bash script using grep and awk that will allow you to parse apache logs to see what users downloaded a file in a certain time period:

grep 'somefile.wmv' /var/log/apache2/*.log | cut -f1,3,4 -d' ' | sort | tr -d '[' | tr '/' ':' | awk '{ split($3,a,":"); if(a[3] == 2011 && a[2] == "Dec" && a[1] >= 20 && a[1] <= 24 && a[4] >= 0 && a[4] <= 13 && a[5] >= 0 && a[5] <= 45) { print $0 } }' | more

Where a[1] is the date range and a[4]:a[5] is the time range.  What this returns is a list of users who have downloaded the file within the specified time period.

Walker
www.lairdscomputer.com

 
Previous Previous
 
Next Next
  Forum  Open Source Tec...  Apache Server  Parsing Apache logs to see what users downloaded a file in a certain time period
Send me One Million FREE Guaranteed Visitors