Image for awstats http://www.awstats.org an Open Source log analyzer and (web) statistics package
10K+
All-in-one Awstats Docker Image for scheduled log-processing on multiple domains with minimal config, accessible via built-in webpage. Find built Docker Images on Docker Hub. NB some links below refer to relative files on GitHub, read full/latest README here.
awstats configs, i.e. (web)sites.env file with a few variables or with a complete awstats conf filesawstats (via cron) within the Docker containersubpath (prefix) for running behind reverse proxyThe aim was to make this image as self-contained as possible with minimal host-dependencies.
This Docker setup is based on work from: https://github.com/pabra/docker_awstats.
That image runs with Alpine Linux. Due to some of the more advanced
features I used, like GeoIP, bash-scripts, it became too complex (at least for me!) to use Alpine Linux
and extend that good work. Also I wanted to reduce host-dependency, e.g. needing cron from host.
Also for deploy in e.g. Kubernetes.
I would be happy if someone manages to migrate justb4/awstats to Alpine, preferably
extending https://github.com/pabra/docker_awstats !
See the test directory for a complete example.
Basically justb4/awstats needs to find files within the following (internal) dirs:
/etc/awstats/sites/ per-site file configs, either .env (vars) or complete awstats conf files/var/local/log the log files, although you can determine log-locations/filenames in your .env or .conf fileAs awstats keeps its data onder /var/lib/awstats you will need to make that dir persistent over restarts,
as a Docker Volume either mapped from a local dir on you host or an explicit Docker Volume.
The intention is to have this Docker image as self-contained as possible in order to
avoid host-bound/specific actions and tooling, in particular log processing via
host-based cron, we may even apply logrotate later. Also allow for multiple domains with minimal config.
Further design choices:
awstats processing (via cron).env file (expand with envsubst into template .conf).conf file as wellsubpath (prefix) for running behind reverse proxy via AWSTATS_PATH_PREFIX= env varA debian-slim Docker Image ((buster version) is used as base image.
(I'd love to use Alpine, but it became too complicated
with the above features, input welcome!).
The entry program is supervisord that will run a setup program once, apache2 webserver daemon
(for the landing page and logstats), and cron for Awstats processing.
Awstats only processes lines in log files that are newer than the newest already
known line.
This means you cannot analyze older log files later. Start with oldest ones first.
You may need to delete already processed data by rm /var/lib/awstats/*
Example sketch of bash-script to process old Apache2 logfiles partly gzipped:
#!/bin/bash
#
# Run the app
#
#
# Example gzipped log files from mydomain.com-access.log.2 up to mydomain.com-access.log.60
LOGDIR="/var/local/log"
LOGNAME="access.log"
END=60
# Loop backwards 60,59,...2.
for i in $(seq $END -1 2)
do
logFile="${LOGDIR}/${LOGNAME}.${i}"
echo "i=${i} logFile=${logFile}"
docker exec -it awstats gunzip ${logFile}.gz
docker exec -it awstats awstats -config=mydomain.com -update -LogFile="${logFile}"
docker exec -it awstats gzip ${logFile}
done
# Non-zipped remaining files
docker exec -it awstats awstats -config=mydomain.com -update -LogFile="${LOGDIR}/${LOGNAME}.1"
docker exec -it awstats awstats -config=mydomain.com -update -LogFile="${LOGDIR}/${LOGNAME}"
Content type
Image
Digest
sha256:5228237ca…
Size
113.6 MB
Last updated
over 2 years ago
docker pull justb4/awstats