What is AWSTATs and How to use AWSTATs ?
What is Awstats and How to use AWStats?
http://www.awstats.org/
What is AWStats?
AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from the command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other webs, proxy, wap, streaming servers, mail servers and some FTP servers.
Take a look at this comparison table for an idea on features and differences between most famous statistics tools (AWStats, Analog, Webalizer,…).
AWStats is a free software distributed under the GNU General Public License. You can have a look at this license chart to know what you can/can’t do.
As AWStats works from the command line but also as a CGI, it can work with all web hosting providers which allow Perl, CGI and log access.
Requirements to install Awstats
Perl 5.007003 or higher required to run AWStats 6.9 or higher
Check you installed Perl version
perl -v
How to install Awstats
Installation process of Awstats
yum install awstats
Now configure it with website for analysis
Edit file
Take a backup of configuration file then continue further
vim /etc/httpd/conf.d/awstats.conf <Directory "/usr/share/awstats/wwwroot"> Options None AllowOverride None <IfModule mod_authz_core.c> # Apache 2.4 Require ip 192.168.1.0/24 </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order allow,deny Allow from 127.0.0.1 Allow from 192.168.1.0/24 </IfModule> </Directory>
———————————————
Restart the web server
sudo service httpd restart
———————————————
sudo cp /etc/awstats/awstats.localhost.localdomain.conf etc/awstats/awstats.example.com.conf
Now make some changes in
sudo vim /etc/awstats/awstats.techouse.co.in.com.conf
Edit these lines
# Change to Apache log file, by default it's /var/log/apache2/access.log LogFile="/var/log/httpd/access.log" # Change to the website domain name SiteDomain="techouse.co.in" SiteDomain="techouse.co.in" HostAliases="www.techouse.co.in localhost 127.0.0.1" HostAliases="www.techouse.co.in localhost 127.0.0.1" # When this parameter is set to 1, AWStats adds a button on report page to allow to "update" statistics from a web browser AllowToUpdateStatsFromBrowser=1
Restart the web server
service httpd restart
How to create report manually and also update it manually?
I am going to create techouse.html file manually which will show the website report
techouse.co.in/techouse.html
This will check updated logs
sudo /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=techouse.co.in -update
This will create file on the mentioned path
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=$file.com -output -staticlink > /home/awstats/$user.html
Give appropriate permission accordingly
chown user:user techouse.co.in.html https://techouse.co.in/techouse.co.in.html
This is the script which will automatically do all these manual steps
#!/bin/bash echo "config filename , Enter the filename that you have created /etc/awstats/techouse.co.in.com.conf" read file echo "enter the username" read user sudo /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=$file.com -update /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=$file.com -output -staticlink > /home/awstats/$user.html chown $user:$user /home/awstats/$user.html