Monitor Apache Web Traffic In Real Time With The Command apachetop
In this tutorial we will have a quick look at the apachtop command. This is great for monitoring your webserver in a terminal or while SSHed into your system.
What is ApacheTop:
It is defined as a Realtime Apache monitoring tool. It basically watches your log files in realtime and displays the output. This can be real handy for trouble shooting as well as keeping an eye on what files are being accesses at that time.
How to install on Ubuntu Server:
sudo apt-get install apachetop
Enter your user’s password
Confirm installing apachetop by entering Y and hitting enter.
How to use apachetop command:
The first thing you will need to know is the location of your apache logs. If you have not changed this the default location on Ubuntu server is set to /var/log/apache2/access.log.
Use the following command to start apachetop: (Edit /var/log/apache2/access.log to the path of your logfile(S))
sudo apachetop –f /var/log/apache2/access.log
By default apachetop removes querystrings from being displayed. If you want to view querystrings add a -q option to the apachtop command. For example: sudo apachetop –qf /path/to/log/file
Example of commnad with query option:
Example of URL with query string:
Here is an example of apachetop output with no one accessing the site.
Here is an example of apachetop with the web server being accessed.
Note: Each line is a file being called. Depending on how your site is built, A single page request can call multiple items such as images, css files..etc.
Make sure you also check out the man pages for apachetop for other useful options.
If you enjoyed this post, please share it on your favorite social network by clicking on the “Share / Save” bar below.