How to Install and Configure Apache log analizer, AWstats on Fedora 16

Share this Article :

In this post, i will share the quick steps to install and Configure Apache log analizer, AWstats on Fedora 16 linux server. AWStats is an open source and featureful Web analytics reporting tool and server logfile analyzer, that suitable for analyzing data from Internet services such as web, streaming media, mail and FTP servers that shows you the statistics including visits, unique visitors, pages, hits, rush hours, os, browsers, search engines, keywords, robots visits, broken links and more.

AWstats Features :

  • Apache log file analyzer
  • Mail log file analyzer
  • FTP log file analyzer
  • Html static or dynamic reporting
  • Can process splitted log file for clusters
  • High speed
  • High log format size
  • Can be enhanced by plugins

To install AWstats, simply run the following command :

[root@fedora16 ~]# yum install awstats -y

Example :

[root@fedora16 ~]# yum install awstats -y
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package awstats.noarch 0:7.0-6.fc16 will be installed
--> Processing Dependency: perl(Switch) for package: awstats-7.0-6.fc16.noarch
--> Processing Dependency: perl(LWP::UserAgent) for package: awstats-7.0-6.fc16.noarch
--> Running transaction check
---> Package perl-Switch.noarch 0:2.16-1.fc16 will be installed
---> Package perl-libwww-perl.noarch 0:6.02-3.fc16 will be installed
--> Processing Dependency: perl(HTTP::Cookies) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(File::Listing) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(HTTP::Daemon) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(WWW::RobotRules) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(HTTP::Negotiate) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Running transaction check
---> Package perl-File-Listing.noarch 0:6.02-3.fc16 will be installed
---> Package perl-HTTP-Cookies.noarch 0:6.00-3.fc16 will be installed
---> Package perl-HTTP-Daemon.noarch 0:6.00-3.fc16 will be installed
---> Package perl-HTTP-Negotiate.noarch 0:6.00-3.fc16 will be installed
---> Package perl-WWW-RobotRules.noarch 0:6.01-3.fc16 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                     Arch           Version               Repository                   Size
 awstats                     noarch         7.0-6.fc16            updates                     1.1 M
Installing for dependencies:
 perl-File-Listing           noarch         6.02-3.fc16           Fedora16-Repository          11 k
 perl-HTTP-Cookies           noarch         6.00-3.fc16           Fedora16-Repository          25 k
 perl-HTTP-Daemon            noarch         6.00-3.fc16           Fedora16-Repository          19 k
 perl-HTTP-Negotiate         noarch         6.00-3.fc16           Fedora16-Repository          16 k
 perl-Switch                 noarch         2.16-1.fc16           fedora                       21 k
 perl-WWW-RobotRules         noarch         6.01-3.fc16           Fedora16-Repository          17 k
 perl-libwww-perl            noarch         6.02-3.fc16           Fedora16-Repository         199 k

Transaction Summary
Install       8 Packages

Total download size: 1.4 M
Installed size: 4.1 M
Downloading Packages:
(1/8): awstats-7.0-6.fc16.noarch.rpm                                         | 1.1 MB     00:32
(6/8): perl-Switch-2.16-1.fc16.noarch.rpm                                    |  21 kB     00:00
Total                                                                38 kB/s | 1.4 MB     00:39
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : perl-HTTP-Negotiate-6.00-3.fc16.noarch                                           1/8
  Installing : perl-HTTP-Daemon-6.00-3.fc16.noarch                                              2/8
  Installing : perl-HTTP-Cookies-6.00-3.fc16.noarch                                             3/8
  Installing : perl-File-Listing-6.02-3.fc16.noarch                                             4/8
  Installing : perl-WWW-RobotRules-6.01-3.fc16.noarch                                           5/8
  Installing : perl-libwww-perl-6.02-3.fc16.noarch                                              6/8
  Installing : perl-Switch-2.16-1.fc16.noarch                                                   7/8
  Installing : awstats-7.0-6.fc16.noarch                                                        8/8

  awstats.noarch 0:7.0-6.fc16

Dependency Installed:
  perl-File-Listing.noarch 0:6.02-3.fc16          perl-HTTP-Cookies.noarch 0:6.00-3.fc16
  perl-HTTP-Daemon.noarch 0:6.00-3.fc16           perl-HTTP-Negotiate.noarch 0:6.00-3.fc16
  perl-Switch.noarch 0:2.16-1.fc16                perl-WWW-RobotRules.noarch 0:6.01-3.fc16
  perl-libwww-perl.noarch 0:6.02-3.fc16


Change the awstats virtualhost configuration file for fedora16.ehowstuff.local

[root@fedora16 ~]# vi /etc/awstats/awstats.fedora16.ehowstuff.local.conf

Modify at line 122 for log format in httpd.conf is ‘combined’ Set here ‘1’ and line 168 to set IP address to exclude :

HostAliases="localhost REGEX[fedora16\.ehowstuff\.local$] REGEX[^192\.168\.1\.]"

Modify awstat main configuration file, awstats.conf :

[root@fedora16 ~]# vi /etc/httpd/conf.d/awstats.conf

Add Alias “Alias /report “/usr/share/awstats/wwwroot/”” and “Allow” :

Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"
Alias /report "/usr/share/awstats/wwwroot/"

# This is to permit URL access to scripts/files in AWStats directory.

    Options None
    AllowOverride None
    Order allow,deny
    Allow from

# Additional Perl modules

    SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins

Restart the Apache httpd service :

[root@fedora16 ~]# systemctl restart httpd.service

Generate reports

[root@fedora16 ~]# /usr/share/awstats/wwwroot/cgi-bin/ -config=fedora16.ehowstuff.local -update

Output :

Create/Update database for config "/etc/awstats/awstats.fedora16.ehowstuff.local.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...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 0
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 0 new qualified records.

Generate HTML from reports :

[root@fedora16 ~]# /usr/share/awstats/wwwroot/cgi-bin/ -config=fedora16.ehowstuff.local -output -staticlink > /usr/share/awstats/wwwroot/index.html

Change cron’s setting :

[root@fedora16 ~]# vi /etc/cron.hourly/awstats
exec /usr/share/awstats/tools/ now         -configdir="/etc/awstats"         -awstatsprog="/usr/share/awstats/wwwroot/cgi-bin/" >/dev/null
exit 0

Change to the following. Uncomment and add the following lines. The new cron’ setting should as below :

#exec /usr/share/awstats/tools/ now         -configdir="/etc/awstats"         -awstatsprog="/usr/share/awstats/wwwroot/cgi-bin/" >/dev/null
/usr/share/awstats/wwwroot/cgi-bin/ -config=fedora16.ehowstuff.local -update > /dev/null
/usr/share/awstats/wwwroot/cgi-bin/ -config=fedora16.ehowstuff.local -output -staticlink > /usr/share/awstats/wwwroot/index.html
exit 0

Leave a Reply