I'm not sure why the two instances of AWStats behave differently (maybe because the version is different or because they are hosted on a different OS), but the only way I could get it working with this Docker image was to specify the exact format used in Azure logs as you can see in the docker-compose.yml file above. But when I tried to use the same configuration with this Docker image, it skipped all log entries because of invalid format:ĭropped record (method/protocol '/index.html' not qualified when LogType=W). Although the logs from Azure include additional fields, it seems to work just fine. On my local server I still have it set to "2" as documented in the AWStats setup guide for IIS. The trickiest part was specifying the correct log format. The launch command for the service passes in the mount location of the server logs. I read the local path from an environment variable on the host. The local directory with the server logs is mounted in read-only mode. The awstats-db named volume will hold the statistics and will be shared between both services. LOG_FORMAT= " %time2 %other %method %url %query %other %logname %host %ua %other %referer %other %code %other %other %bytesd %other %other" The first one would generate the statistics from the log files: version: '3' To simplify the use, I decided to wrap all the configuration details in a Docker Compose file.įollowing the idea of separate flows for generating and viewing the statistics meant that I had to create two services. I liked how the command for generating the statistics was separate from running the site. I chose to base my configuration on the openmicroscopy/awstats image.
Of course, I wasn't the first one to think of that. I could configure AWStats in a container and run it locally on my workstation when needed. What if I could just run it on demand when I need it instead?ĭocker seemed a perfect tool for the job.
Since I'm only looking at the statistics a few times a year at most, I don't really need to have AWStats running all the time on my local server. Although I'm hosting my blog in Azure, I have a local instance of AWStats configured for analyzing the server logs.