so far I have not been able to find an answer online or in any book. I would like to count how many times /foo/ was hit on my site. If anyone could help, Thank you!
Asked
Active
Viewed 30 times
1 Answers
1
Enter this on a command line:
grep -c '/foo/' /var/log/httpd/access_log
This will show the number of counts of "/foo/" inside of your apache acess log file.
There are more access log files:
access_log.2 access_log.4
access_log.1 access_log.3 access_log.5
If you want to see the result from older entries, then you can use
grep -c '/foo/' /var/log/httpd/access_log*
Result:
/var/log/httpd/access_log:46
/var/log/httpd/access_log.1:85
/var/log/httpd/access_log.2:46
/var/log/httpd/access_log.3:103
/var/log/httpd/access_log.4:70
/var/log/httpd/access_log.5:177
The path depends on your Redhat version.
http://www.itninja.com/blog/view/mysql-and-apache-profile-log-path-locations

Franz Holzinger
- 913
- 10
- 20
-
Thank you Franz Holzinger, this seemed to work. I did not have a count with "/foo/" but then used "/foo' and counted some hits. Is there a reason for this ? – ThomasC Oct 05 '17 at 16:49
-
Which result does `grep '/foo' /var/log/httpd/access_log` give? – Franz Holzinger Oct 05 '17 at 17:37