How to use docker compose to setup AWStats

Have added changes to incorporate both generating AWStats logs and starting up AWStats service in a single docker compose file at KarMeng / docker_awstats — Bitbucket

Sample docker compose for AWStats

This is an easy and simple example that beginners can use to generate web statistics using AWStats.

Required softwares:
Hashicorp Vagrant 2.4.1
Oracle VirtualBox 7.0.14

Starting up VirtualBox headless using vagrant

“vagrant up” needs to be run twice, if you are using the code for the first time. The reason is the setup.sh provision script will bootstrap the VirtualBox with docker engine, and configure the VirtualBox VM to work properly.

Login into VirtualBox VM using vagrant ssh

Caveat:

Configure your apache logs to match the proper log format, in this case the apache access log reference has alot of details.

The apache access log format are as follows:

Hence, the format of the logs collected in access log for the apache service is as follows:

This leads to the AWStats log format to be the following:

Only with the caveat resolved in your machine, that you only proceed to process your own apache logs using AWStats.

Or using the sample from my repository, just run the following steps.

How to run the AWStats docker:

  1. Ensure that logs are placed into ./logs/ , there is a working sample apache log file
  2. To start up the VM, change path into ./localdev/ , in the path using command prompt run “vagrant up”
  3. It may take a while for the VBOX image to build.
  4. After the vbox are completed, rerun “vagrant up”
  5. Next, “vagrant ssh” to login to the VBOX shell
  6. In the VBOX shell, run “cd /data/docker”
  7. Finally run, “sudo docker compose up -d”, wait for the docker containers to complete
AWStats docker is ready

View the AWStats using your browser http://127.0.0.1:8080

AWStats example of processed apache web logs

Reference:
Damir’s Corner : Running AWStats on Demand with Docker

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.