Using apachetop with a Community Server

Having just installed apachetop on a community server to get an overview of what sites are busy on the server, I needed to create a single log file to read. Adding a line into each Apache stanza was simple but tiresome, I simply added this line:

        CustomLog /data/logs/all.log combined

This gave me a central log file which has all of the sites in it, then I can call the apachetop program with he following format:

apachetop -f /data/logs/all.log

This worked really well with one problem. Th server has a lot of sites running WordPress and the like and apachetop was not differentiating in its output. The solution was to use Apache and create a new logging format. I wanted to shim the ‘ServerName’ into the request so I could see which site’s wp-login.php (for example) page it actually was showing. My new format is:

    LogFormat "%h %l %u %t \"%m %v%U%q %H\" %>s %B" central

Its called ‘central’ so I needed to update the apache config accordingly which sed took care of it quickly and painlessly. Now I get output like:

  304 10.13 879.0 29.3*
   22  0.81   0.0  0.0
    4  0.13 222.5  7.4
    3  0.12  15.5  0.6
    2  0.07 112.9  3.8
    1  0.03   0.7  0.0
This entry was posted in Apache and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *