Introduction
Apache is a powerful web server, and cPanel offers excellent management capabilities, but when you need to diagnose what’s consuming resources or causing slowdowns, the built-in tools can be limited. ApacheTop helps by providing real-time analysis of your web server traffic.
One of the most useful diagnostic methods is examining raw Apache logs. However, if you’re managing a busy site or a server with dozens (or more) domains, ApacheTop becomes an invaluable tool for getting a clear picture of what’s happening on your server.
cPanel Preparation
If you’re using cPanel, I recommend combining your domain logs first to make analysis more straightforward. You can find instructions for combining Apache logs here. While there are alternative methods for consolidating logs, any approach that combines your logs will work with ApacheTop.
Installation on CentOS
The following installation instructions are specific to CentOS, though you can install ApacheTop on most Linux distributions with similar package management commands.
Enable EPEL Repository
First, enable the EPEL (Extra Packages for Enterprise Linux) repository. This gives you access to third-party repositories not directly maintained by CentOS. As with any third-party repository, appropriate caution is warranted.
Run the following command:
yum install epel-release
If this command doesn’t work, search for the appropriate epel-release RPM package for your version of CentOS.
Note: Installing this package will clear your YUM cache files, so the next command may take a few minutes longer than usual to complete.
Install ApacheTop
Once EPEL is enabled, installing ApacheTop is straightforward:
yum install apachetop
That’s all there is to the installation process!
Using ApacheTop
To run ApacheTop, simply execute the command and direct it to your Apache log file. The tool will begin reading logs from that point onwards. Press the space bar to refresh the statistics more frequently than the default interval.
apachetop -f /usr/local/apache/logs/vhost-access_log
Useful Tips
While using ApacheTop, press ?
to access the help menu for a complete list of commands and options.
Here are some particularly useful features:
- Press d to cycle through different statistical views
- The host view displays the number of hits and data transfer for each host, making it easy to identify poorly behaving clients
- The referrer view shows where your traffic is coming from—especially useful if a site has received publicity and is experiencing heavy traffic
For the most meaningful analysis, I recommend leaving ApacheTop running for at least 5 minutes to gather sufficient data before evaluating the results.
Practical Applications
ApacheTop can help you:
- Identify individual IP addresses causing excessive traffic
- Determine which pages or resources are most frequently requested
- Monitor bandwidth consumption in real-time
- Detect potential DDoS attacks or unusual traffic patterns
- Optimise your server configuration based on actual usage patterns
Conclusion
ApacheTop is a lightweight yet powerful tool for real-time monitoring of Apache web servers. By providing immediate insights into server activity, it helps administrators quickly identify and address performance issues before they impact users.
For cPanel administrators, combining this tool with consolidated Apache logs creates an efficient monitoring solution that makes troubleshooting significantly easier.
Have fun and happy debugging!