AWStats has been around for quite some time. GoDaddy uses it for their web logs, so I figured I would just use it for mine.
I had actually written a log monitor in perl but probably not worth the time it would take to find the old source code,
Setup was fairly simple (well, not really), but you need to adjust a few things to proceed.
Download awstats from
their website.
(
Install Ref)
mkdir /usr/local/awstats
Copy all of the file to the root of /usr/local/awstats
sudo cd /usr/local/awstats/wwwroot/tools
sudo perl awstats_configure.pl
This should get you most of the installation but you will need to answer specific questions such as the path to your web server
.conf file.
If you have set up apache with the default, it will probably reside under
/etc/apache2/sites-enabled
Standard webserver on port 80 will be
000-default.conf
If you have set up SSL, it will likely be:
00-default-le-ssl.conf
This is where you will point awstats to change the configuration.
(note: when you do an apache reset, it will copy this to the sites-available so you only need to set it in sites-enabled)
Once config has completed, you should have a new awstats config file under
/etc/awstats
sudo ls /etc/awstats to see the file.
Per the documentation, you can go in and edit any of the settings within this file and they will apply to your awstats page.
Updates to scheduled cron jobs appears to be a manual process...
You can set it up to run every hour at 5 minutes before the hour using
crontab -e
Add the line:
5 * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=myawstatsite -update
ctrl-x to overwrite and save.
-----> 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=YOURCONFIG
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Securing awstats access
Ref:Apache
Create a new directory for your passwords that is not under any of the websites paths.
sudo mkdir /usr/local/pwds
Create a new password file and username using htaccess.
sudo htpasswd -c /usr/local/pwds/passwords USERNAME
Enter the pwd for the user when prompted. (You can type htpasswd without prompts to get additonal settings parameters)
(Notice: This is assuming you are using https (port 443).. you do not want to pass basic auth using http (port 80))
In your directory section on the conf file that provides the path for awstats add the following:
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile "/usr/local/apache/pwds/passwords"
Require user USERNAME
Restart the apache service -
sudo sudo systemctl restart apache2
The next time you visit the page, you will get prompted for credentials.