Install AWStats on SuSE Leap 15

AWStats is a log analyzer which creates advanced web, ftp, mail and streaming server statistics reports based on data contained in your server logs. This data is graphically presented in your browser.
I used to use AWStats on my Apache based servers years ago, and even today it is not part of the SuSE Linux distro.
Well, fear not I will show you how to easily get to the point of running your own log analyzer.
First of all, head on over to the resource for ‘open source’ software development and ‘distribution’ site, Souceforge to download the latest release. Here is the direct link: https://awstats.sourceforge.io/#DOWNLOAD
The latest release being awstats-7.7-1.noarch.rpm
Once downloaded onto our SuSE system, be safe and back up the Apache configuration file httpd.conf in /etc/apache2 prior to running the below.
When ready run:
Tones: # rpm -i awstats-7.7-1.noarch.rpm
The majority of files are installed in the newly created /usr/local/awstats, and a few in /etc/awstats. Changes are also made to your apache’s httpd.conf file.
Reponses to prompts are in bold.
Tones: # cd /usr/local/awstats/tools
Tones: # ./awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
-----> Running OS detected: Linux, BSD or Unix
-----> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /etc/apache2/httpd.conf
-----> Check and complete web server config file '/etc/apache2/httpd.conf'
Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
Add '<Directory>' directive
AWStats directives added to Apache config file.
-----> Update model config file '/etc/awstats/awstats.model.conf'
File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> example.co.uk
-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>
-----> Create config file '/etc/awstats/awstats.example.co.uk.conf'
Config file /etc/awstats/awstats.example.co.uk.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=example.co.uk
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...
A SIMPLE config file has been created: /etc/awstats/awstats.example.co.uk.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'example.co.uk' with command:
> perl awstats.pl -update -config=example.co.uk
You can also read your statistics for 'example.co.uk' with URL:
> http://localhost/awstats/awstats.pl?config=example.co.uk
Press ENTER to finish...
For your information the following is added to your httpd.conf file:
# # Directives to add to your Apache conf file to allow use of AWStats as a CGI. # Note that path "/usr/local/awstats/" must reflect your AWStats Installation path. # Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/" Alias /awstatscss "/usr/local/awstats/wwwroot/css/" Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/" ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/" # # This is to permit URL access to scripts/files in AWStats directory. # <Directory "/usr/local/awstats/wwwroot"> Options None AllowOverride None Order allow,deny Allow from all </Directory>
Advice: Change the ‘Allow from’ to the network address/es that you only want to run the report.
awstats_configure.pl creates a file called /etc/awstats/awstats.example.co.uk.conf being the configuration file you MUST now check.
Tones: # cd /etc/awstats Tones: # vi awstats.example.co.uk.conf
Verify the LogFile value. It should be the full path of your server log file.
Verify the LogType value. It should be “W” for analyzing web log files.
Check if LogFormat is set to “1” (for “NCSA apache combined/ELF/XLF log format”) or use a custom log format if you don’t use the combined log format.
Set the SiteDomain parameter to the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mysite.com).
If you want the option to update your report stats manually, then set the AllowToUpdateStatsFromBrowser parameter to ‘1’. Just click on the link “Update now” at the top of the AWStats report page.
We now have to manually build the statistics database.
Tones: # cd /usr/local/awstats/wwwroot/cgi-bin Tones: # mkdir /var/lib/awstats Tones: # perl awstats.pl -config=example.co.uk -update Create/Update database for config "/etc/awstats/awstats.example.co.uk.conf" by AWStats version 7.7 (build 20180105) From data in log file "/var/log/apache2/access.log"... Phase 1 : First bypass old records, searching new record... Direct access after last parsed record (after line 1742) Jumped lines in file: 1742 Found 1742 already parsed records. Parsed lines in file: 371 Found 0 dropped records, Found 0 comments, Found 0 blank records, Found 0 corrupted records, Found 0 old records, Found 371 new qualified records.
Now, the only remaining task left, is to compile the report html files.
Tones: # cd /usr/local/awstats/wwwroot/cgi-bin Tones: # perl awstats.pl -config=mysite -output=alldomains -staticlinks > awstats.example.co.uk.alldomains.html Tones: # perl awstats.pl -config=mysite -output=allhosts -staticlinks > awstats.example.co.uk.allhosts.html Tones: # perl awstats.pl -config=mysite -output=lasthosts -staticlinks > awstats.example.co.uk.lasthosts.html Tones: # perl awstats.pl -config=mysite -output=unknownip -staticlinks > awstats.example.co.uk.unknownip.html Tones: # perl awstats.pl -config=mysite -output=alllogins -staticlinks > awstats.example.co.uk.alllogins.html Tones: # perl awstats.pl -config=mysite -output=lastlogins -staticlinks > awstats.example.co.uk.lastlogins.html Tones: # perl awstats.pl -config=mysite -output=allrobots -staticlinks > awstats.example.co.uk.allrobots.html Tones: # perl awstats.pl -config=mysite -output=lastrobots -staticlinks > awstats.example.co.uk.lastrobots.html Tones: # perl awstats.pl -config=mysite -output=urldetail -staticlinks > awstats.example.co.uk.urldetail.html Tones: # perl awstats.pl -config=mysite -output=urlentry -staticlinks > awstats.example.co.uk.urlentry.html Tones: # perl awstats.pl -config=mysite -output=urlexit -staticlinks > awstats.example.co.uk.urlexit.html Tones: # perl awstats.pl -config=mysite -output=browserdetail -staticlinks > awstats.example.co.uk.browserdetail.html Tones: # perl awstats.pl -config=mysite -output=osdetail -staticlinks > awstats.example.co.uk.osdetail.html Tones: # perl awstats.pl -config=mysite -output=unknownbrowser -staticlinks > awstats.example.co.uk.unknownbrowser.html Tones: # perl awstats.pl -config=mysite -output=unknownos -staticlinks > awstats.example.co.uk.unknownos.html Tones: # perl awstats.pl -config=mysite -output=refererse -staticlinks > awstats.example.co.uk.refererse.html Tones: # perl awstats.pl -config=mysite -output=refererpages -staticlinks > awstats.example.co.uk.refererpages.html Tones: # perl awstats.pl -config=mysite -output=keyphrases -staticlinks > awstats.example.co.uk.keyphrases.html Tones: # perl awstats.pl -config=mysite -output=keywords -staticlinks > awstats.example.co.uk.keywords.html Tones: # perl awstats.pl -config=mysite -output=errors404 -staticlinks > awstats.example.co.uk.errors404.html
That completes the configuration of AWStats on SuSE Linux.
Now you can open your browser and see your first report.
Substitute 127.0.0.1 for the internal IP address of the server if running the report from a network machine.
http://127.0.0.1/awstats/awstats.pl?config=example.co.uk
Hope it all worked for you.
Tone.