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

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
====================================================================================================
Installing:
 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

Installed:
  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

Complete!

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 :

..
..
LogFormat=1
..
..
..
HostAliases="localhost 127.0.0.1 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 192.168.1.0/24” :

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 127.0.0.1 192.168.1.0/24

# 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/awstats.pl -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/awstats.pl -config=fedora16.ehowstuff.local -output -staticlink > /usr/share/awstats/wwwroot/index.html

Change cron’s setting :

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

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

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

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7

This short howto will explain the steps to reset a lost root password or to reset a forgotten root password on Linux RHEL 7 or CentOS 7. Basically, we will...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

Leave a Reply

Your email address will not be published. Required fields are marked *