# Apache 2 & Webalizer

## mixmasterdj2002

I just installed Apache 2, and that works lovely.. And I have just emerged webalizer, to view the usage stats, and because that is what the manager wants... How would I go about making webalizer work with apache 2...

I know there is an ebuild to make it work with apache 1, but how would I go about configuring webalizer to work with apache 2...?

Thanks In Advance.

----------

## slartibartfasz

just set the logformat of apache to combined and then edit the webalizer conf to whatever u like. add a cronjob to run webalizer. [optional]configure permissions for the statistics dir in apache.[/optional] finished   :Cool: 

----------

## mixmasterdj2002

sorry, I am fairly new to this, could you tell me how I would perform the steps you suggested, as I really do not know..  :Razz: 

----------

## slartibartfasz

no problem - when i began i didnt know either   :Confused: 

u can do all the steps with the text editor of your choice. most people use nano, vi or joe on the console. the editor nano is part of the gentoo system, so u already installed that  :Smile: 

1) editing apache conf:

u need to do this as root. if u use a desktop manager (kde, gnome, ...) open a console and

```

# su -

## type your root password

# nano /etc/apache2/conf/commonapache2.conf

```

go to the section where it says

```

<IfModule mod_log_config.c>

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

    <IfModule mod_logio.c>

        # You need to enable mod_logio.c to use %I and %O

        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

# The location and format of the access logfile (Common Logfile Format).

#CustomLog logs/access_log common

#

# If you would like to have agent and referer logfiles, uncomment these

#CustomLog logs/referer_log referer

#CustomLog logs/agent_log agent

#

# If you prefer a single logfile with access, agent, and referer information

# (Combined Logfile Format) you can use the following directive.

#CustomLog logs/access_log combined

#

</IfModule>

# End of Log directives.

```

and change that to use the combined logfile format (u can use others too but this is probably the easiest). if u dont understand the comments go to apache.org and read the detailed instructions there. then u have to check if everything went allright with the syntax: 'apachectl configtest' - then restart apache by '/etc/init.d/apache2 restart'. open a browser, point it to localhost and browse a little bit to get some entries into the log.

u can follow the logentries by doing 'tail -f /var/log/apache2/access_log' in a console. then u go about to configure webalizer. (i dont have it installed currently, so i cant post details) u can find it by 'find /etc | grep webalizer.conf'. same procedure as above: 'nano -w /some/path/webalizer.conf' and change it to your liking. there are a lots of comments explaining everything.

last thing to do is to run webalizer: 'webalizer'  :Wink:  - if everything worked u can add it to your crontab to run it on a regular basis. read 'man cron', 'man crontab', 'man 8 cron' and most important 'man 5 crontab' (this one explains how a crontab looks like).

if u run into troubles ask again...

----------

## b52_

Hi,

iam using apache2 and will install webalizer on my system. I allready altered the configfiles like mentioned above, but it still don't work! It drives me crazy!

My commonapache2.conf

```
    <IfModule mod_logio.c>

        # You need to enable mod_logio.c to use %I and %O

        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

                                                                                                                                                 

# The location and format of the access logfile (Common Logfile Format).

#CustomLog logs/access_log common

#

# If you would like to have agent and referer logfiles, uncomment these

#CustomLog logs/referer_log referer

#CustomLog logs/agent_log agent

#

# If you prefer a single logfile with access, agent, and referer information

# (Combined Logfile Format) you can use the following directive.

CustomLog logs/access_log combined

#

</IfModule>

# End of Log directives.

                                                                                                                                                 
```

My apache2.conf

```

### Log configuration Section

###

<IfModule mod_log_config.c>

#Single logfile with access, agent and referer information

#This is the default, if vlogs are not defined for the main server

CustomLog logs/access_log combined

#env=!VLOG

#If VLOG is defined in conf/vhosts/vhosts.conf, we use this entry

#CustomLog "|/usr/sbin/apache2splitlogfile" vhost env=VLOG

</IfModule>

                                                                                                                                                 

###

### Virtual Hosts

```

My webalizer.conf in line 28

```

# the log filename ends in '.gz' (ie: a gzip compressed file), it will

# be decompressed on the fly as it is being read.

                                                                                                                                                 

LogFile /var/log/apache2/access_log 

                                                                                                                                                 

# LogType defines the log type being processed.  Normally, the Webalizer

# expects a CLF or Combi

```

My mpf* Syntax error

```

asterix conf # apache2ctl -t

Syntax error on line 28 of /usr/lib/apache2/conf/webalizer.conf:

Invalid command 'LogFile', perhaps mis-spelled or defined by a module not included in the server configuration

asterix conf #

```

 :Shocked: 

Please help me! I really don't know why i get these error.  :Crying or Very sad: 

Add: If i comment Logfile out, the error appears at the next Command.

Thank you

----------

## el_mariel

```

asterix conf # apache2ctl -t

Syntax error on line 28 of /usr/lib/apache2/conf/webalizer.conf:

Invalid command 'LogFile', perhaps mis-spelled or defined by a module not included in the server configuration

asterix conf #

Please help me! I really don't know why i get these error.

Add: If i comment Logfile out, the error appears at the next Command.

Thank you
```

You are getting these errors because you include the wrong file in apache2.conf

Replace this line:

Include  conf/webalizer.conf

to:

Include  conf/modules.d/55_webalizer.conf

----------

## zenner

hi! who knows, where is the problem?

```
Webalizer V2.01-10 (Linux 2.6.14-gentoo-r2) English

Using logfile /var/log/apache2/access_log (clf)

Error: Can't change directory to DIR
```

File: /etc/apache2/conf/webalizer.conf

```
OutputDir      /home/dan/wwwroot/1
```

----------

## hanj

Can you provide the output for the following command:

```
ls -al /home/dan/wwwroot/1
```

I think it may be permissions problem on the directory?? Just a guess.

hanji

----------

## chief1983

 *zenner wrote:*   

> hi! who knows, where is the problem?
> 
> ```
> Webalizer V2.01-10 (Linux 2.6.14-gentoo-r2) English
> 
> ...

 

I just ran into that.  It doesn't use that conf file, it uses /etc/webalizer.conf.  Try setting that one up and see what happens.

----------

## vivid8474

maybe there isn't that dir.

----------

