# awstats Configuration Issues

## Bob P

i've been tinkering with awstats.  i've run into two issues that i need to ask for help with:

1.  icons are absent from the reports.

i have prepared the "standard" awstats summary report using the commands: 

```
awstats.pl -update -config=domainname.com

awstats.pl -config=domainname.com -output -staticlinks > <path-to-output-file>
```

the result is a decent summary report of the overall system activity.  the only problem is that the report's histograms, which are supposed to be displayed as colored bars, are being displayed as text line characters that are somewhat difficult to read.  presumably, this is because awstats cannot find the icons files when preparing the report.

i've followed the awstats configuration instructions, and i've made a point of doing the following:

a.  copying the awstats "icon" sub-directories to a directory that is visible to my webserver

b.  edited my http server's config file to reflect the newly created icon directories in the webserver's root

c.  edited the awstats.domainname.com.conf file to have a "DirIcons=" value that matches the newly created icon directories in the webserver's file root.

even so, when running awstats with the following command, the icons do not get included in the report:

```
awstats.pl -config=domainname.com -output -staticlinks > <path-to-output-file>
```

i'm left scratching my head trying to figure out why the colorized histogram icons are not included in the report.  :Confused: 

2.  "awstats_buildstaticpages.pl" does not exist

when reading the installation docs for awstats, the section entitled, "Reports Build: Building and reading reports" suggests the use of awstats_buildstaticpages.pl  in order to allow all of the detailed statistics pages to be built using a single command.

unfortunately, awstats_buildstaticpages.pl  is nowhere to be found.   :Confused: 

am i missing something?

TIA!

----------

## Sith_Happens

1) The installation instructions have you using a perl script to install awstats to some directory, however portage already installs awstats to /usr/share/webapps/awstats/<version>/hostroot/.  So what you should do is use that directory as your document root in apache or whatever http server your using.  Here is the virtual host entry for awstats from my apache2.conf:

```
<VirtualHost 127.0.0.1:51400>

   ServerName awstats

   DocumentRoot /usr/share/webapps/awstats/6.3-r2/hostroot/

   <Directory "/usr/share/webapps/awstats/6.3-r2/hostroot/">

       Options None

       AllowOverride None

       Order allow,deny

       Allow from all

   </Directory>

</VirtualHost>
```

As far as generating the pages, I just set AllowToUpdateStatsFromBrowser=1 in my awstats configuration file, and run the update script from the browser.  It generates text files in /var/lib/awstats  Which are digests of the log files, and then dynamically generates the webpages using a perl script.  That works just fine for me.

2) 

```
root@BlueBox root # equery f awstats | grep buildstatic

/usr/bin/awstats_buildstaticpages.pl
```

Did you look there?  Perhaps you need to reinstall.

----------

## Bob P

 *Sith_Happens wrote:*   

> 1) The installation instructions have you using a perl script to install awstats to some directory, however portage already installs awstats to /usr/share/webapps/awstats/<version>/hostroot/. 

 

yes, the fact that the gentoo installtion differs from the official documentation created a few interesting discrepancies that had to be chased down following the install process.   :Confused:   ultimately, the easiest thing to do was to just reinstall.

its interesting that awstats was installing its perl scripts into two separate locations.  i don't know if this is an artifact of portage or an artifact of the awstats perl installation script (yes, i did run the install script), but it doesn't really make alot of sense to have one of the scripts located here:

usr/share/webapps/awstats/6.3-r2/hostroot/cgi-bin/awstats.pl 

while the other is located here:

/usr/bin/awstats_buildstaticpages.pl

go figure.   :Confused: 

 *Quote:*   

> As far as generating the pages, I just set AllowToUpdateStatsFromBrowser=1 in my awstats configuration file, and run the update script from the browser.  It generates text files in /var/lib/awstats  Which are digests of the log files, and then dynamically generates the webpages using a perl script.  That works just fine for me.

 

AFAIK if you only use the awstats.pl script, your html report  will only be one page deep -- if you don't use the buildstaticpages script, then the hyperlinks within the report will lead to 404-type pages.  there are some interesting reports that can be made by invoking the awstats_buildstaticpages.pl script, that include things like detailed lists that were used to create the summary statistics.  so i'd like to use them as long as i can find the script.  now that i know where it is, it looks like i'm in business.  :Wink: 

if you want to update from within the browser, that can be done fairly quickly if you're only using the awstats.pl script.  if you want to get the detailed reports, though, the buildstaticpages script takes a pretty long time to execute, so my preference is to update it periodically (hourly) via a cron job.

its interesting that you've chosen to enable cgi scripts.  i didn't, because some of the preliminary research that i had done seemed to point to its cgi implementation as being where the vulnerabilities lie in the awstats exploits that allow a hostile user to execute code with apache privs, so i steered away from them.  but if you ca you're running apache in a chrooted environment, i guess you'd be okay.

have you enabled DNS lookup/IP resolution in your reports yet?  i haven't done it yet.  i'm thinking it would be interesting to view logons by country.  :Cool: 

----------

## Sith_Happens

 *Bob P wrote:*   

> its interesting that awstats was installing its perl scripts into two separate locations. i don't know if this is an artifact of portage or an artifact of the awstats perl installation script (yes, i did run the install script), but it doesn't really make alot of sense to have one of the scripts located here:
> 
> usr/share/webapps/awstats/6.3-r2/hostroot/cgi-bin/awstats.pl
> 
> while the other is located here:
> ...

 Actually it makes perfect sense.  The first script needs to be accessed by the web browser to build the statistics pages, while the second only needs to be accessed by a local user.  So the first goes into the document root, while the second goes into /usr/bin. *Bob P wrote:*   

> AFAIK if you only use the awstats.pl script, your html report will only be one page deep -- if you don't use the buildstaticpages script, then the hyperlinks within the report will lead to 404-type pages.

 Nope, it creates a single summary page along with individual detail pages. *Bob P wrote:*   

> if you want to update from within the browser, that can be done fairly quickly if you're only using the awstats.pl script. if you want to get the detailed reports, though, the buildstaticpages script takes a pretty long time to execute, so my preference is to update it periodically (hourly) via a cron job. 

 It does take longer to create static pages, and since creating them dynamically using awstats.pl does it fast and convieniently from a web-browser, and gives you access to the same information, I don't see why you would do it any other way for your situation.  It does make sense to run the update perl script as a cron job though, especially if you have an active site.  However, building static pages doesn't really make any sense to me unless you want to save or back them up.  If you just want to view the up to date parsed log information kept in /var/lib/awstats in an html format, then you shouldn't need to deal with static pages. *Bob P wrote:*   

> have you enabled DNS lookup/IP resolution in your reports yet? i haven't done it yet. i'm thinking it would be interesting to view logons by country

 I have, and right now I just have it set up to show domain names.  If you want it to show you country of origin, you need to load the GeoIP (cost's money to get the required perl module) or GeoIPfree (free as in beer) AWStats plugin.

----------

## Sith_Happens

Update: emerge Geo-IP  and use the GeoIP plugin (not GeoIPfree)

----------

## Bob P

solved the icon problem.  its turns out that in the configuration file, i had listed the FULL PATH to the /icons directory, instead of listing the RELATIVE PATH to /icons from the webserver root.  D'Oh!

----------

## Bob P

 *Sith_Happens wrote:*   

> Update: emerge Geo-IP  and use the GeoIP plugin (not GeoIPfree)

 

Its been so long that I had forgotten about this thread.  Yes, I have emerged Geo-IP and used the Geo-IP plugin.  In some respects it is a step forward, and in some respects it is a step backward.   

with Geo-IP turned off, *.com, *.net, and *.mil addresses would be grouped in the Country report as *.com, *.net, and *.mil addresses.  

With Geo-IP turned on, these domains are completely ignored and they are thrown into the wastebasket category of "unknown" countries.  with the Geo-IP plugin functioning, I've got an awful lot of IPs that get properly resolved by DNS to domainnames, but who's GeoIP country is defined as "Unknown."  for example, US military addresses are resolved to fully qualified domain names ending in *.mil, but Geo-IP fails to resolve the country of origin (USA).  The same is true for all of the *.net, *.com type of addresses that are US-based, and get properly resolved to fully qualified domainnames, but the GeoIP country remains "unknown."  I've even got IP addresses that get resolved to fully qualified domain names with extensions like *.de and *.ca that are listed in the "GeoIP Unknown Country" list.  i'm kind of surprised that GeoIP fails to resolve extensions like *.de to Germany, and extensions like *.ca to Canada.

so it seems rather counter-intuitive that awstats properly resolves fewer IP addresses by country of origin when Geo-IP is enabled.  :Exclamation:   :Question: 

looking at the Awstats configuration file under the plugins section, there appear to be additional plugins that allow the resolution of IP Regions, Cities, ISPs, Orgs.  Are these in portage?  I haven't been able to find them doing an emerge -S for "GeoIP".

----------

## Bob P

DOES AWSTATS PHONE HOME?

I've been watching my router and my modem while I use awstats to build static web pages.  Interestingly, while the web pages are being built, I always notice blinking lights indicating traffic from the server to the router and to the modem.  This happens even if I turn off my http server.  :Exclamation: 

Does awstats phone home when it builds static pages?!?

----------

## Sith_Happens

 *Bob P wrote:*   

> DOES AWSTATS PHONE HOME?
> 
> I've been watching my router and my modem while I use awstats to build static web pages.  Interestingly, while the web pages are being built, I always notice blinking lights indicating traffic from the server to the router and to the modem.  This happens even if I turn off my http server. 
> 
> Does awstats phone home when it builds static pages?!?

 It's doing DNS lookups, and the GeoIP plugin is checking IP's against an online country database.

----------

