Awstats
AWStats is a powerful tool which generates server statistics. AWstats works as a CGI or from command line and shows you all possible information your log contains in a graphical way.
Installing Lighthttpd and Awstats
For installing the additional packages first activate community packages:
vi /etc/apk/repositories
Uncomment the following:
http://pkg.example.com/alpine/v3.11/community
Update the packagelist:
apk update
Install the additional packages:
apk add lighttpd php7-common php7-session php7-iconv php7-json php7-gd php7-curl php7-xml php7-mysqli php7-imap php7-cgi fcgi php7-pdo php7-pdo_mysql php7-soap php7-xmlrpc php7-posix php7-mcrypt php7-gettext php7-ldap php7-ctype php7-dom php7-simplexml
Configure Lighttpd
Edit lighttpd.conf
vi /etc/lighttpd/lighttpd.conf
Uncomment line:
include "mod_fastcgi.conf"
Start lighttpd service and add to needed runlevel
rc-service lighttpd start && rc-update add lighttpd default
Installing Awstats
apk add awstats -U -X http://build.alpinelinux.org:8009/backports/1.10/ --allow-untrusted
In /etc/lighttpd/lighttpd.conf:
Change the base server root folder #server.document-root = var.basedir + "/htdocs" server.document-root = "/usr/lib/awstats"
Configuting Awstats
Run awstats_configure.pl
awstats_configure.pl
-----> Running OS detected: Linux, BSD or Unix Do you want to continue setup from this NON standard directory [yN] ? y -----> Check for web server install Config file path ('none' to skip web server setup): none -----> Need to create a new config file ? y -----> Define config file name to create Example: www.mysite.com Example: demo Your web site, virtual server or profile name: awstats -----> Define config file path >/etc/awstats Press ENTER to continue... Press ENTER to finish...
Edit awstats.awstats.conf
nano /etc/awstats/awstats.awstats.conf Search the line LogFile=" " and configure your log path and file. e.g. LogFile="/var/log/messages"
Start http server and add to boot
/etc/init.d/lighttpd start && rc-update add lighttpd default
Browse
http://AWSTATS_IP_NUMBER/cgi-bin/awstats.pl?config=awstats
Note: Awstats is not working yet with dansguardian logs.