1

Topic: Awstats not working on FreeBSD 8.2

System: FreeBSD 8.2 64bit (new install)
iRedMail: Latest (new install), MySQL Backend

Symptom: No statistics on awstats, An attention message: "Last Update: Never updated (See 'Build/Update' on awstats_setup.html page)"

Logs
Cron:  Apr 11 13:01:02 mail /usr/sbin/cron[5022]: (root) CMD (perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=smtp -update >/dev/null)
Apr 11 13:01:02 mail /usr/sbin/cron[5023]: (root) CMD (perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=web -update >/dev/null)

it seems working

Installation History : FreeBSD Install broken at Postfix install and iredapd install (it says something like "I can't find iredapd.x.x.x.tar file"). I fixed portfix first (make clean && make install clean) and install iredmail then fixed the iredapd installation (i use this (http://www.iredmail.org/wiki/index.php? … D/OpenLDAP) tutorial but changed it for mysql backend) Now mail server working very well but awstats not. Thank you in advance for your help.

Not: Sorry about my English.

Best Regards

Hasan Alp İNAN

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Awstats not working on FreeBSD 8.2

Selam

Genel olarak FreeBSD kullandığım için tercih ettim. Daha önce CentOS üzerinde kullanıyordum ama son güncellemelerde kararsızlık görünce FreeBSD'ye taşıdım. Şu an sunucu normal çalışıyor. Tek sorun awstats. Onu da çözeriz inşallah. Öneri için teşekkürler.

Sana da iyi çalışmalar.

3

Re: Awstats not working on FreeBSD 8.2

I think it's better to communicate in English here, so that all users can understand what you mean.
I can understand your English, that means others can understand too. smile

4

Re: Awstats not working on FreeBSD 8.2

Ok. smile

i did some test on awstat.

i gave command below

perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=web -update

a few line is interesting in command output

1.

Create/Update database for config "/usr/local/www/awstats/cgi-bin/awstats.web.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd-access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 1263)
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/httpd-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)"

2.

Setup ('/usr/local/www/awstats/cgi-bin/awstats.web.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

File Permissions are

-r-xr-xr-x  1 root  wheel   61653  9 Nis 06:29 awstats.web.conf
-r-xr-xr-x  1 root  wheel   61449  9 Nis 06:29 awstats.smtp.conf

Directory Permissions

drwxr-xr-x   8 root       wheel       512  9 Nis 06:26 awstats

if permissions ok, awstats config file is wrong. But i did not do any editing. Something weird.

5

Re: Awstats not working on FreeBSD 8.2

hainan wrote:

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

Seems Awstats can't parse your apache log.

iRedMail just configure 3 settings in Awstats:
- SiteDomain
- LogFile
- Lang

Can you help its LogFormat setting and your Apache access_log format?

6

Re: Awstats not working on FreeBSD 8.2

i'm trying now.

7

Re: Awstats not working on FreeBSD 8.2

Yes you're right.

My Server Apache access.log is seems like this

xx.xx.xx.xx - - [09/Apr/2011:10:55:14 +0300] "GET /mail/?_task=mail HTTP/1.1" 200 6131

and awstats example log

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)"

there are serious differences between these log formats. Is iRedMail setup system uses one type configuration file for awstats on all supported systems? if so iredmail setup system should be compatible with FreeBSD systems.

I'm trying to fix now.

8

Re: Awstats not working on FreeBSD 8.2

Hi

Somethin wierd. i created a new log file and test again.

1. try

mail# perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=web -update
Create/Update database for config "/usr/local/www/awstats/cgi-bin/awstats.web.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd-access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access to last remembered record is out of file.
So searching it 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: 3
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 3 new qualified records.

yes it worked. But when i look at the awstats page some new lines added to apache access log file and perl script return an error similar like above post.

xx.xx.xx.xx - - [11/Apr/2011:16:51:26 +0300] "GET /awstatsicons/other/vu.png HTTP/1.1" 404 223

xx.xx.xx.xx is server ip. I think this is awstats web page error log. icons were not display. This log lines are different than the standart records. So awstats script return an error. How can i fix this? May i disable awstats web page log?

Where is the icons?

I check icons directory and found it in /usr/local/www/awstats. But on web page all of them missing. When i look to the awstats.web.conf, directory setup DirIcons="/awstatsicons" but there is no directory whit this name. i create a symlink to icons directory. But nothing changed.

9 (edited by hainan 2011-04-11 23:04:59)

Re: Awstats not working on FreeBSD 8.2

Yes i found icons problem and fix it. The solution is just add a line in /usr/local/etc/apache22/httpd.conf file.

Alias /awstatsicons "/usr/local/www/awstats/icons/"

or add line in

/usr/local/etc/apache22/Includes/awstats.conf

file.

10

Re: Awstats not working on FreeBSD 8.2

SOLVED

The fix about this error is really simple.

1. STEP

Edit /usr/local/etc/apache22/Includes/awstats.conf file.

Remove # sign at the beginning of these lines.

Alias /awstatsicons "/usr/local/www/awstats/icons/"
ScriptAlias /awstats "/usr/local/www/awstats/cgi-bin/"
Alias /css "/usr/local/www/awstats/css/"
Alias /js "/usr/local/www/awstats/js/"

Add this lines.


<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # 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
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    #CustomLog "/var/log/httpd-access.log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    CustomLog "/var/log/httpd-access.log" combined
</IfModule>

2. STEP

Below iredmail default awstats cron entry on FreeBSD.

1   */1   *   *   *   perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=web -update >/dev/null
1   */1   *   *   *   perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=smtp -update >/dev/null

When i test them, commands working but awstats web page cannot see any data. I search the web and found some tutorials. Then i found a difference in commands. i changed as follows:

1   */1   *   *   *   perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=awstats.web.conf -update >/dev/null
1   */1   *   *   *   perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=awstats.smtp.conf -update >/dev/null

After this changes everything working very well.

In addition if you want to change Awstats default language (en) you can change it in awstats.*.conf files. For me tr (Turkish) is a good choice. smile

Best Regards

Hasan Alp İNAN

11

Re: Awstats not working on FreeBSD 8.2

Thanks for the fix. I will test it later and commit it into iRedMail.
[I have limit internet access this month, it's impossible for me to test FreeBSD since it will download distfiles.]