Integrating Awstats in CentOS Web Panel | Centos 6/7

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 command line and shows you...

2 Mins Read
9.7K Views

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 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 web, proxy, wap, streaming servers, mail servers and some ftp servers.

 

Installation Instruction

cd /usr/local/
git clone https://github.com/eldy/awstats.git
cd awstats
perl tools/awstats_configure.pl

 

Do you want me to setup Apache to write ‘combined’ log files [y/N] ? –> y
Do you want me to build a new AWStats config/profile file (required if first install) [y/N] –> y
Your web site, virtual server or profile name: –> cwp
Directory path to store config file(s) (Enter for default): –> press enter

 

Setup Awstats Logging

mkdir -p /var/lib/awstats
sed -i 's|var/\log/\httpd/\mylog.log|usr\/local/apache/logs/access_log|g' /etc/awstats/awstats.cwp.conf
rm -rf /usr/local/apache/logs/access_log

 

Enable CGI in Apache

Copy paste all lines not one by one

cat > /usr/local/apache/conf.d/mod_cgid.conf << "EOF"
LoadModule cgid_module modules/mod_cgid.so
<IfModule cgid_module>
<Directory /usr/local/awstats/wwwroot/cgi-bin/>
Options ExecCGI SymLinksifOwnerMatch
SetHandler cgi-script
AddHandler cgi-script .cgi .pl .py
Require all granted
AllowOverride All
</Directory>
</IfModule>
EOF

 

Restart Apache

service httpd restart

 

Make cron to update Awstats every 1 minute

crontab -l | { cat; echo "* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp"; } | crontab -

 

Access Awstats

http://serverip/awstats/awstats.pl?config=cwp

 

Exit mobile version