File: webalizer-HOWTO.html

package info (click to toggle)
gforge 3.1-31sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,148 kB
  • ctags: 11,865
  • sloc: sql: 27,860; php: 25,574; perl: 7,124; xml: 3,152; sh: 2,586; ansic: 315; makefile: 143
file content (70 lines) | stat: -rw-r--r-- 3,515 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<title>Webalizer HOWTO</title>
</head>
<body>

<h2><center>Webalizer HOWTO</center></h2>
<h3><center>Updated 05/20/03</center></h3>

<p><a href="http://www.mrunix.net/webalizer/">Webalizer</a> is a tool for creating <a href="http://cougaarforge.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://cougaarforge.cougaar.org">CougaarForge</a> uses Webalizer to create usage graphs for each virtual host and a combined usage page as well.

<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:
<pre>
<VirtualHost *>
 ServerName csmart.cougaarforge.cougaar.org
 DocumentRoot /var/www/gforge-3.0/csmart
 CustomLog /usr/local/var/httpd/log/csmart-access_log common
 ErrorLog /usr/local/var/httpd/log/csmart-error_log
</VirtualHost>
</pre>

<p>Then I create a $project/usage/ directory and put a placeholder page in there.  Like this:
<pre>
    mkdir "/var/www/gforge-3.0/$project/usage/"
    cp /var/www/gforge-3.0/www/usage/msfree.png /var/www/gforge-3.0/$project/usage/
    cp /root/webalizer/index.html /var/www/gforge-3.0/$project/usage/
</pre>

<p>Note that I also copied the msfree.png file in there to prevent future broken links.

<p>Next, I create a webalizer.conf file specifically for this host.  This can usually be done by cranking another site's webalizer.conf thru sed:
<pre>
sed -e "s/project_one/project_two/g" /etc/webalizer/project_one-webalizer.conf > /etc/webalizer/project_two-webalizer.conf
</pre>

<p>I've got a shell script set up that runs every night and runs Webalizer against all those log files, like this:
<pre>
#!/bin/bash

# run webalizer on cougaarforge.cougaar.org first
/usr/bin/webalizer -c /etc/webalizer/cougaarforge-webalizer.conf

# run webalizer on all the logs after combining and sorting them
cat /usr/local/var/httpd/log/*access_log > /usr/local/var/httpd/log/all_access_log_unsorted
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 /usr/local/var/httpd/log/all_access_log_unsorted
> /usr/local/var/httpd/log/all_access_log
/usr/bin/webalizer -c /etc/webalizer/cougaarforge-all-webalizer.conf
rm /usr/local/var/httpd/log/all_access_log
rm /usr/local/var/httpd/log/all_access_log_unsorted

for project in `ls /var/www/gforge-3.0/ | grep -v prototype | grep -v www | grep -v common`
do
        # create the usage directory if it's not there
        if [ ! -e "/var/www/gforge-3.0/$project/usage/" ]; then
                mkdir "/var/www/gforge-3.0/$project/usage/"
                cp /var/www/gforge-3.0/www/usage/msfree.png /var/www/gforge-3.0/$project/usage/
                cp /root/webalizer/index.html /var/www/gforge-3.0/$project/usage/
        fi

        # run webalizer on this project
        /usr/bin/webalizer -c /etc/webalizer/$project-webalizer.conf
done
</pre>

<p>Nifty, huh?  So now you can get to each project's usage page with a URL something like this - <a href="http://tutorials.cougaarforge.cougaar.org/usage/">http://tutorials.cougaarforge.cougaar.org/usage/</a> - and there's a <a href="http://cougaarforge.cougaar.org/usage_all/">combined page</a>, too!

<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>.
 
</body>
</html>