steps to visualize HTTP server logging – part I
apache
check Apache server version by creating a simple e.g. serverinfo.php file with following statement: <?php phpinfo(); ?>
and open in your browser: http://your host/serverinfo.php. Find the version info in the Apache Version section:
Apache Version – Apache/2.0.53 (Linux/SUSE)
or run from the command line:
/usr/sbin # apache2ctl -v
Server version: Apache/2.0.53
Server built: Aug 30 2006 13:14:23
h969344:/usr/sbin #
Next add mod_status to your APACHE_MODULES by editing /etc/sysconfig/apache2 configuration – the Status module allows a server administrator to find out how well a server is performing. A HTML page is presented that gives the current server statistics in an easily readable form:
APACHE_MODULES=
“access actions alias auth auth_dbm autoindex cgi
dir env expires headers include log_config mime
mod_status negotiation setenvif
ssl suexec userdir php4 rewrite”
In the same file and if extended logging is needed, set APACHE_EXTENDED_STATUS=”on” – be careful here, this will degrade performance.
Edit httpd.conf and add a Location section to your virtualhost section (remove Include /etc/apache2/mod_status.conf):
<VirtualHost *:80>
….
<Location /server-status>
SetHandler server-status
# Order deny,allow
# Deny from all
Allow from .yourdomain
</Location>
….
</VirtualHost>
restart the HTTP server: /usr/sbin/rcapache2 restart
You should see your Apache server status now by issuing this URL: http://yourHost/server-status providing the following information:
- The number of worker serving requests
- The number of idle worker
- The status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker (*)
- A total number of accesses and byte count served (*)
- The time the server was started/restarted and the time it has been running for
- Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request (*)
- The current percentage CPU used by each worker and in total by Apache (*)
- The current hosts and requests being processed (*)
The lines marked “(*)” are only available if ExtendedStatus is On
awstats
To display HTTP server log information in a graphical form, install awstats:
AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically.
Copy awstats to a directory of your choice, installation defaults to /usr/local/awstats. Then run the awstats configuration process: perl awstats_configure.pl, which will add directives to your httpd.conf and create a configuration file (default location: /etc/awstats)
[SinglePic not found]<Directory “/usr/local/awstats/wwwroot”>
Options all
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”
Alias /awstatscss “/usr/local/awstats/wwwroot/css/”
Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”
ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”
Once done run the data import process from the cgi-bin folder of your awstats installation (you can automate this in the config file): perl awstats.pl config=yourdomain. See results of your site: http://yourdomain/awstats/awstats.pl or at this demo site
This link to part II of the tutorial.
Comments (One comment)
[...] also Part I of this [...]
steps to visualize HTTP server logging - part II | bernhard.hensler.net / September 1st, 2009, 20:09 / #
Post a comment