ApacheTop - Monitor your website apache server in real time
Follow @ggarronIf you have an apache server, you should be familiar with google analytics, awstats or other good ways to see statics about the use of your site, some of this services are free some others not, and they present you with a lot of good info, but the most of them are not in real time, you may want to see some statics in realtime about your site. A real good tool for this is apachetop, which will run on your server and present you with a some real time information about your site load, and the pages being seen at a given moment.
Installing apachetop
sudo aptitude install apachetop
Using apachetop
To start this monitor tool run:
apachetop -f /var/log/apache2/access.log
This will indicate apachetop the log file to parse, be sure to have permission to read that file, and you will see something like this:

Define the loggin interval
There are two ways to do this, one is to define the time interval to log, the other is to define the number of hits to catch and show.
apachetop -T 120
This will tell apachetop to log all hits in a 120 seconds interval
apachetop -H 100
This will tell apachetop to log until you get 100 hits, and then start erasing one hit to log the new one.
You can use only one of those switches at a time, ther is a good explanation about this in the man page.
You can either: Use -H to say "remember
Getting details about your hits
If you want to see some details, you can navigate through the list with the cursor keys, up and down, the * (asterisk) indicates where you are in a given moment, once you are on the url you want details about hit the right cursor key, and you will get the details like the referrers of the visits to that url, to go back to the main list again, hit the left cursor key.
This is how details are seen:

Filtering the output
You can also filter the output if you have too many info on the screen you can filter what you will see, to do this, press f you will be presented with three options add, clear, show active, then press the (a) key, and you will see another three options, u for urls, r for referrers, or h for hosts, hit the one you need.
Conclusion
This is a very useful tool, to check in real time which pages are being seen on your server, and where is the load of your apache server, it will be useful when your site is in problems, but be sure not to monitor with a too long timeframe or too many hits, (T and H switches), or your will use too much CPU and Memory resources, just agravating the problem.