3 <title>Webalizer HOWTO</title>
4 <style type="text/css">
5 h2, h3 { text-align: center; }
6 pre { width: 90%; background: silver; overflow: auto; }
11 <h2>Webalizer HOWTO</h2>
12 <h3>Updated 05/20/03</h3>
14 <p><a href="http://www.mrunix.net/webalizer/">Webalizer</a> is a tool for creating <a href="http://cougaar.org/usage/">nice graphs</a> of web site usage. It's not too hard to set up, but hopefully this document will show how <a href="http://cougaar.org">CougaarForge</a> uses Webalizer to create usage graphs for each virtual host and a combined usage page as well.
16 <p>First, when I add a new project to CougaarForge, I create a new virtual host entry in httpd.conf with a log file for that host:
19 ServerName csmart.cougaar.org
20 DocumentRoot /var/www/gforge-3.0/csmart
21 CustomLog /var/log/httpd/csmart-access_log common
22 ErrorLog /var/log/httpd/csmart-error_log
26 <p>Then I create a <samp>$project/usage/</samp> directory and put a placeholder page in there. Like this:
28 # mkdir "/var/www/gforge-3.0/$project/usage/"
29 # cp /var/www/gforge-3.0/www/usage/msfree.png /var/www/gforge-3.0/$project/usage/
30 # cp /root/webalizer/index.html /var/www/gforge-3.0/$project/usage/
33 <p>Note that I also copied the <samp>msfree.png</samp> file in there to prevent future broken links.
35 <p>Next, I create a <samp>webalizer.conf</samp> file specifically for this host. This can usually be done by cranking another site's <samp>webalizer.conf</samp> thru <samp>sed</samp>:
37 # sed -e "s/project_one/project_two/g" /etc/webalizer/project_one-webalizer.conf > /etc/webalizer/project_two-webalizer.conf
40 <p>I've got a shell script set up that runs every night and runs Webalizer against all those log files, like this:
44 # run webalizer on cougaar.org first
45 /usr/bin/webalizer -c /etc/webalizer/cougaarforge-webalizer.conf
47 # run webalizer on all the logs after combining and sorting them
48 cat /var/log/httpd/*access_log > /var/log/httpd/all_access_log_unsorted
49 sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M -k 4.2,4.3n -k 4.14,4.15n -k 4.17,4.18n -k 4.20,4.21n /var/log/httpd/all_access_log_unsorted
50 > /var/log/httpd/all_access_log
51 /usr/bin/webalizer -c /etc/webalizer/cougaarforge-all-webalizer.conf
52 rm /var/log/httpd/all_access_log
53 rm /var/log/httpd/all_access_log_unsorted
55 for project in `ls /var/www/gforge-3.0/ | grep -v prototype | grep -v www | grep -v common`
57 # create the usage directory if it's not there
58 if [ ! -e "/var/www/gforge-3.0/$project/usage/" ]; then
59 mkdir "/var/www/gforge-3.0/$project/usage/"
60 cp /var/www/gforge-3.0/www/usage/msfree.png /var/www/gforge-3.0/$project/usage/
61 cp /root/webalizer/index.html /var/www/gforge-3.0/$project/usage/
64 # run webalizer on this project
65 /usr/bin/webalizer -c /etc/webalizer/$project-webalizer.conf
69 <p>Nifty, huh? So now you can get to each project's usage page with a URL something like this - <a href="http://tutorials.cougaar.org/usage/">http://tutorials.cougaar.org/usage/</a> - and there's a <a href="http://cougaar.org/usage_all/">combined page</a>, too!
71 <p>I've probably forgotten some important details; if you can think of a way to improve this document, please post to the <a href="http://gforge.org/forum/?group_id=1">GForge forums</a>.