Sunday, April 02, 2006

Install and configure webalizer on Ubuntu

  1. install webalizer

    sudo apt-get install webalizer

    If webalizer is not found, you have to add sources in /etc/apt/sources.list: can comment the universe sources.

  2. Enable the apache2 hostname resolution: go into /etc/apache2/apache2.conf: Change

    HostnameLookups Off


    HostnameLookups On

  3. By default webalizer is not well configured: it does not check in the good log. In /etc/webalizer.conf: Change

    LogFile /var/log/apache2/access.log.1


    LogFile /var/log/apache2/access.log

  4. Test webalizer:

    sudo webalizer

    If you get a warning like warning: Truncating ...
    It is because you did not put the hostnameLookup. If afterward, you get this message, it can be because you are attacked by a virus...

  5. Run webalizer as a cronjob. This has to be run as root: Edit the root cronjobs by running the command:

    sudo crontab -e

    and add the line:

    0 * * * * webalizer

    With that line, every hour webalizer is run


Blogger Mark Gaved said...

cheers for this help. Very useful. One comment - on the current version of Ubuntu (Breezy) the version of Apache might be 2, so the change to help the log files work might be /var/log/apache2/access.log for some people (it was for me). If you get an error, try checking this...

3:15 AM  
Anonymous Anonymous said...

Same Thing Happened To Me.

4:40 PM  
Anonymous Anonymous said...

Very useful! It worked for me!! :)

10:51 AM  
Anonymous John said...

Thankyou ! real easy.

1:57 AM  
Anonymous Anonymous said...

it works for me, very easylah -

9:28 PM  
Anonymous TravisS said...

Thank you very much, I looked at other documentation and was going to give up, then I came across this!!!

Thank you again!

9:54 PM  
Anonymous Anonymous said...

Also, you might find webalizer.conf in /etc/webalizer/webalizer.conf

5:55 AM  
Blogger Rafa said...

zankiu veri much esquiusmi mai english

11:11 AM  
Anonymous Anonymous said...

Thank you I found it very useful.

4:41 AM  
Anonymous Anonymous said...

Once again the linux community is of great assistance

6:37 AM  
Anonymous Anonymous said...

Very nice and wonderfully helpful. Thanks!

I also have a suggestion. Turning HostnameLookups on in Apache can slow the site down, especially if it's a busy server. Instead, it may be more practical to use Apache's logresolve program. So you could write a simple script that resolves IP address in the log before analyzing it. For example:

# Get the name of the log file to use

logfile="`cat /etc/webalizer/webalizer.conf | grep "^LogFile" | cut -d ' ' -f 2`"

# Resolve the IP addresses in the log file before analyzing it

logresolve < $logfile > /tmp/logfile

webalizer /tmp/logfile

rm /tmp/logfile

- apon

3:14 AM  
Blogger Asfand Yar Qazi said...


See here for anothe way of displaying hostnames instead of the IPs found in the log files:

11:37 PM  
Anonymous Anonymous said...

Really thank you very much!!!

11:34 PM  

Post a Comment

<< Home