# Mini-Howto webapp-config install of awstats

## jmckay123456789

The only other Howto that I could find specifically didn't use webapp-config. Since webapp-config is the way that the Gentoo developers seem to endorse, I thought I would try it that way. So here you go. Let me know if you have problems.

Awstats is the best web log analyzer that I know of. I used to have awstats installed manually, but now gentoo has an ebuild for it. I tried

```
# emerge awstats
```

which is sufficient for most apps in gentoo, including webapps. Squirrelmail and gallery both installed fine this way. However, the awstats ebuild tells us that we have to use webapp-config to complete the install of awstats. They do not give a suggested command line. Long story short this is how I managed to install awstats to my host. My website is installed in localhost, but if yours is somewhere else, you will have to modify the command line.

	Create a directory called "awstats" in your root web directory. Then:

```
# webapp-config -I -h localhost -d /awstats/ awstats 6.3-r2
```

  Change version number and hostname as necessary.

	Take the output of the above command and paste into the /etc/apache2/conf/commonapache2.conf file, then:

```
# /etc/init.d/apache2 restart
```

	If you don't already have a config file setup, copy /etc/awstats/awstats.model.conf to /etc/awstats/awstats.yourdomain.conf

Edit awstats.yourdomain.conf. It is pretty easy just by reading the comments.

OK it is installed. Now update the stats:

```
# /usr/share/webapps/awstats/6.3-r2/hostroot/cgi-bin/awstats.pl -config=yourdomain.com -update
```

again, adjust version name and domain name as needed.

Now look at your stats by using your browser to look at:

http://yourwebsite/awstats/awstats.pl

That worked for me.

----------

## MaxDamage

Hey it worked great! It was much easier than the manual install, and automates upgrades. I don't know if it's necessary but there is a way to force files to be created belonging to user apache an group apache:

```
sudo webapp-config -I -h localhost -u apache -g apache -d awstats awstats 6.4
```

Thanx again!

----------

## jmckay123456789

Thanks, I'm glad it was helpful. I haven't tried your tip, but I will next time I update.

----------

## jbNet

also don't forget about the >> operator

so you could do..

```

# webapp-config -I -h localhost -d /awstats/ awstats 6.3-r2 >> /etc/apache2/conf/commonapache2.conf

```

just be sure you have two '>'s otherwise you'll overwrite stuff

----------

## jmckay123456789

bjNet, though your tip is perfecty correct, I personally prefer to see the output myself just to check it for sanity. Also for upgrades you will be wanting to remove the previous stuff so you will be mucking around in that config file anyway.

best,

Cedar

----------

## BlinkEye

thanks for this easy howto. i got awstats quickly up and running. i just read http://awstats.sourceforge.net/docs/awstats_faq.html#MAIL to create a statistic for my mail.log. this worked out well (i see the created *.txt files in /var/www/localhost/htdocs/awstats) but how do i convince awstat to actually display these stats?  i tried to remove my apache txt files within that directory but still no mail stats ...

----------

## NightDragon

Hi!

My basic directory for Websites is /server/www (the file /var/www points as symlink to /server/www).

Inside that dir, i have some domains hosted (controlled by vhost-settings in /etc/apache2/httpd.conf).

e. g.

shadowghost.net

thesilence.nightdragon.at

...

Now... i tried to do this howto, but i can't get awstat running (correctly or overall).

Does anybody know, what i've to do?

----------

## mingotta

hello

Your howto looks great, but I'm stuck.

I get an error when I launch 

/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.pl -config=localhost -update

This is the error:

```
 # /usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.pl -config=localhost -update

Update for config "/etc/awstats/awstats.localhost.conf"

With data in log file "/var/log/apache2/access_log"...

Phase 1 : First bypass old records, searching new record...

Searching new records from beginning of log file...

AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.

Your log file /var/log/apache2/access_log must have a bad format or LogFormat parameter setup does not match this format.

Your AWStats LogFormat parameter is:

1

This means each line in your web server log file need to have "combined log format" like this:

111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"

And this is an example of records AWStats found in your log file (the record number 50 in your log):

10.0.0.85 - - [29/Jan/2006:22:26:30 +0100] "GET /wordpress/wp-images/wp-small.png HTTP/1.1" 304 -

Setup ('/etc/awstats/awstats.localhost.conf' file, web server or permissions) may be wrong.

Check config file, permissions and AWStats documentation (in 'docs' directory).

```

I suppose it's about the apache logfile, which must be "combined".

So I did a grep of the apache config file and this is what I got:

```
 # grep -i -R "logformat" ../apache2/

../apache2/httpd.conf:LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

../apache2/httpd.conf:LogFormat "%h %l %u %t \"%r\" %>s %b" common

../apache2/httpd.conf:LogFormat "%{Referer}i -> %U" referer

../apache2/httpd.conf:LogFormat "%{User-agent}i" agent

../apache2/httpd.conf:LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

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

../apache2/httpd.conf:#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

```

which, unfortunately, doesn't lead me much farther... anybody can suggest where to go from here?

Thanks!

P.s.: I noticed I don't have the file commonapache.conf!!

----------

## mellow

 *mingotta wrote:*   

> hello
> 
> Your howto looks great, but I'm stuck.
> 
> I get an error when I launch 
> ...

 

I had the same problem, but i solved it by adding 

------

Alias /awstats/classes "/usr/share/webapps/awstats/6.5/htdocs/classes/"

Alias /awstats/css "/usr/share/webapps/awstats/6.5/htdocs/css/"

Alias /awstats/icons "/usr/share/webapps/awstats/6.5/htdocs/icon/"

ScriptAlias /awstats/ "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/"

ScriptAlias /awstats "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.p$

ScriptAlias /awstats.pl "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstat$

<Directory "/usr/share/webapps/awstats/6.5/htdocs">

    Options None

    AllowOverride None

    <IfModule mod_access.c>

        Order allow,deny

        Allow from all

    </IfModule>

</Directory>

-------

at the end at "/etc/apache2/httpd.conf" you also need to change your a line

CustomLog logs/access_log common

to

CustomLog logs/access_log combined

.

Just to enable the info the awstats need to generate the report..

Hope the info it's of any use to anyone..

Pether

ps. have a good toke !

----------

## vf1sveritech

how the hell do you remove a config file from the config? say you added a awstats.myftp.conf and you don't need it anymore, so you delete it, but then when you go to awstats.pl it says it can't find it, how do you get rid of it from awstats?

----------

## electroarts

Great tutorial, helped getting it up and running so far. I was able to get awstats to update, as follows:

```
# /usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.pl -config=soundtransit.nl -update

Update for config "/etc/awstats/awstats.soundtransit.nl.conf"

With data in log file "/var/log/apache/access_log"...

Warning: HostAliases parameter is not defined, awstats choose "soundtransit.nl localhost 127.0.0.1".

Phase 1 : First bypass old records, searching new record...

Searching new records from beginning of log file...

Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...

Jumped lines in file: 0

Parsed lines in file: 3845291

 Found 73 dropped records,

 Found 226 corrupted records,

 Found 0 old records,

 Found 3844992 new qualified records.
```

But I get a "404 Not Found" at http://soundtransit.nl/awstats/awstats.pl

I did a "chgrp -R apache" and "chown -R apache" in /var/www/soundtransit.nl/cgi-bin, where the awstats.pl script is located, and even restarted Apache a few different times, but still no luck. What am I missing? Something added to the /etc/apache/conf/apache.conf or the Vhosts file so that Apache can find it??

----------

## electroarts

OK, added the "Alias" lines a couple posts up, and now I get a "Forbidden: You don't have permission to access /awstats/awstats.pl on this server" error. So I know they are there. What permissions do you recommend changing now to get this acessible?

TIA!

----------

## HRH_H_Crab

Like NightDragon I am having problems figuring out how to make this stuff work with vhosts.

My setup is plain vanilla gentoo, with the web server stuff under /var/www/.

However, (and this is where I think things are falling down), under htdocs, Ive made other directories for the various sites, so under there I have foo.org bar.com etc...

Ive followed this how-to, but things just dont seem to work. Ive tried the standard issue symlink kludge, (to the awstats directory, which I made under htdocs too, and to the cgi-bin directory, which lives in localhost, but this doesnt work.

Anyone got any pointers for me?

----------

## HRH_H_Crab

Got it working, was just a case of sorting out my apache config (bringing it up to date) and rearranging the location of the web roots for my various vhosts in a sane manner!

----------

## cpdsaorg

my webserver is a bit insane. I moved the doc root to a folder in a user directory called /home/website/public_html/3.0/

now whenever I install a webapp I have to copy it from htdocs to this /3.0/ directory.

I think I have everything configured right but when i try to access ~website/awstats/cgi-bin/awstats.pl it tries to download the file. 

where am i going wrong?

----------

## maiku

Is't at all possible to make webapp-config use /home/*/public_html instead of /var/www/*/htdocs?

----------

## Phoenix591

there is but, its apache config related.

PS, dude don't dig up 2 year old threads

----------

## longint

Can someone please verify if this HowTo is working for current installations at all?

I just can not make it...

What config entries do I have to add to my vhost confs?

Where is the datadir?

Thx a lot!

----------

## neofutur

 *longint wrote:*   

> Can someone please verify if this HowTo is working for current installations at all?
> 
> I just can not make it...
> 
> What config entries do I have to add to my vhost confs?
> ...

 

 you re right the current awstats/webapp-config is completely broken, the instructions given after install are completely outdated, better make it manually . . .

----------

## adherr

This HowTo helped me as lately as Oct2001, but unfortunately as of 7.0 you can no longer install awstats with webapp-config in this way.  See Gentoo bug #352600.  So your best bet is to use the directions on the awstats sourceforge site: http://awstats.sourceforge.net/docs/awstats_setup.html.  You'll have to change the Alias directives to point to /usr/share/... rather than /usr/local/...

I hope that helps someone.

----------

## upengan78

Hi,

Is there any document for awstats -7.0_p20101205-r3 installation on Gentoo? vhosts flag is not there. I am not understanding where to start with the configuration process after installing this particular version.

----------

