ome / awstats-docker

Run Awstats in Docker
14 stars 9 forks source link
awstats docker

Awstats Docker

Build Status

Generate web server statistics using Awstats. The generation of Awstats statistics is decoupled from the Awstats web interface.

/var/lib/awstats should be a persistent volume.

Usage

Create a named volume:

docker volume create --name awstats-db

Generate web log statistics in awstats-db. The names of the log files to be processed should be passed as command line arguments, wildcards will be expanded. For example, if the web logs are /data/web-logs/access.log-*.gz:

docker run --rm -v /data/web-logs:/web-logs:ro -v awstats-db:/var/lib/awstats \
    openmicroscopy/awstats /web-logs/access.log-\*.gz

Run the Awstats web interface by passing just httpd as an argument:

docker run --rm -p 8080:8080 -v awstats-db:/var/lib/awstats openmicroscopy/awstats httpd

Awstats should now be accessible at http://localhost:8080. Apache authentication is not enabled.

You can update the web log statistics in awstats-db by re-running with the new log files (Awstats will automatically skip duplicate entries, for example if you pass a log file that has already been processed). The new logs must be newer than the existing ones:

docker run --rm -v /data/web-logs-new:/web-logs-new:ro -v awstats-db:/var/lib/awstats \
    openmicroscopy/awstats '/web-logs-new/access.log-\*.gz'

Configuration

The configuration file /etc/awstats/awstats.SITE_DOMAIN.conf will be automatically generated at runtime if it doesn't exist. The generated configuration can be modified using the following optional environment variables, see entrypoint.pl for defaults.

For example

docker run -e SKIP_HOSTS_ADDITIONAL="^1\.1\.  ^2\.2\. " \
    ... openmicroscopy/awstats ...

will skip IPs matching ^1\.1\. ^2\.2\. in addition to the defaults.

Alternatively you can provide a full configuration by mounting /etc/awstats into the container. If no logfiles are passed on the command line the LogFile configuration option will be used.