AWStats (Advanced Web Statistics) is an open source Web analytics reporting tool, suitable for analyzing data from Internet services such as web, streaming media, mail, and FTP servers. AWStats parses and analyzes server log files, producing HTML reports. Data is visually presented within reports by tables and bar graphs. Static reports can be created through a command line interface, and on-demand reporting is supported through a Web browser CGI program.
# dnf install awstats
Use a private website and add to the 443 section:
# cd /etc/httpd/conf/vhosts.d/ # vi private.example.com 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/" <Directory "/usr/share/awstats/wwwroot"> Options None Require all denied Require ip 192.168.1.0/24 Require ip 2a02:a465:54ef::/48 </Directory> <IfModule mod_env.c> SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins </IfModule> # cd /etc/httpd/conf.d/ # mv awstats.conf awstats.con
Test and restart the webserver:
# httpd -t # systemctl restart httpd
We need for every website a configfile.
# cd /etc/awstats/ # cp awstats.model.conf awstats.server1.example.com.conf
We open the new configfile and set it to our needs.
# vi awstats.server1.example.com.conf LogFile="/var/log/httpd/server1-access_log" SiteDomain="server1.example.com" #HostAliases="example.com www.example.com"
Execute below command for updating the log files:
# perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=server1.example.com -update
You can see the stats at:
https://private.example.com/awstats/awstats.pl?config=server1.example.com
# cd /etc/awstats/ # cp awstats.model.conf awstats.mail.example.com.conf
We open the new configfile and set it to our needs.
# line 51: change LogFile="perl /usr/share/awstats/tools/maillogconvert.pl standard < /var/log/maillog |" # line 63: change LogType=M # line 123 comment out and the line below #LogFormat=1 LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd" # line 839: change like follows LevelForBrowsersDetection=0 LevelForOSDetection=0 LevelForRefererAnalyze=0 LevelForRobotsDetection=0 LevelForSearchEnginesDetection=0 LevelForKeywordsDetection=0 LevelForFileTypesDetection=0 LevelForWormsDetection=0 # line 957: change like follows ShowMonthStats=UHB ShowDaysOfMonthStats=HB ShowDaysOfWeekStats=HB ShowHoursStats=HB ShowDomainsStats=0 ShowHostsStats=HBL ShowRobotsStats=0 ShowEMailSenders=HBML ShowEMailReceivers=HBML ShowSessionsStats=0 ShowPagesStats=0 ShowFileTypesStats=0 ShowOSStats=0 ShowBrowsersStats=0 ShowOriginStats=0 ShowKeyphrasesStats=0 ShowKeywordsStats=0 ShowMiscStats=0 ShowHTTPErrorsStats=0 ShowSMTPErrorsStats=1
# cd /srv/www/vhosts/private.example.com/httpdocs/ # mkdir aw-stats # cp article.html aw-stats/index.html # cd aw-stats/ # vi index.html <div id="inhoud"> <h1>AWstats</h1> <ul class="lijst"> <li><a href="https://prive.example.com/awstats/awstats.pl?config=www.example.com">www.example.com</a></li> <li> </li> <li><a href="https://prive.example.com/awstats/awstats.pl?config=mail.example.com">email</a></li> </ul> </div> <!--einde inhoud --> </body> </html>