LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to log Apache server hits? (https://www.linuxquestions.org/questions/linux-server-73/how-to-log-apache-server-hits-605747/)

javedmk80 12-10-2007 03:22 AM

How to log Apache server hits?
 
Hello list:

I need to know is there any software that can monitor the number of hits (server load) to my Apache web server on CentOS 5? alongwith their IPs? (if possible)

Or in other words, Is there any such command to check real time server-hits (or server load, whichever is correct term)?

Thank you for your support

trickykid 12-10-2007 08:36 AM

There's webalizer.

Or create your own script really, the apache log is fairly straight forward.

Usually the logs always start out with the IPAddress, you could do something like this to get the number of unique IP's that visited:

cat /var/log/httpd/access_log | cut -d" " -f1 | sort -n | uniq | wc -l

Or if you want total number of hits, take the uniq out:

cat /var/log/httpd/access_log | cut -d" " -f1 | sort -n | wc -l

Take the wc -l off at the end like this to get all the IPAddresses that have visited your site:

cat /var/log/httpd/access_log | cut -d" " -f1 | sort -n | uniq

Get creative or use something like webalizer like mentioned.

complich8 12-10-2007 09:50 AM

how about ...
tail -f access_log

how about enabling the /server-status url for your ip?

javedmk80 12-11-2007 05:02 AM

Hi,

Thank you both trickybird and Complich8 for your support.


All times are GMT -5. The time now is 11:30 AM.