Coder Social home page Coder Social logo

kub-awstat's Introduction

Docker Image Version Docker Pulls Docker Image Size (tag) docker-build-and-push

README

Awstats container based on httpd:2.4-alpine to keep it small. It's configures that way, so you can easily put a reverse proxy (like Nginx) in front.

Read all about awstats config

Supported tags and respective Dockerfile links

Quickstart

# start the container
docker run \
    --detach \
    --restart always \
    --publish 3000:80 \
    --name awstats \
    --volume /var/log/nginx:/var/local/log:ro \
    --volume /var/lib/awstats:/var/lib/awstats \
    pabra/awstats

# ensure awstats can read your logs
docker exec awstats awstats_updateall.pl now

Now point your browser to http://my_website:3000/.

Add this line to your /etc/crontab to let Awstats analyze your logs every 10 minutes:

*/10 * * * * root docker exec awstats awstats_updateall.pl now > /dev/null

By default, the timezone in the container will be UTC. To configure a different timezone in your container, set the environment variable TZ to your timezone, adding the following to your command line at the container start:

    --env TZ="Antarctica/South_Pole"

Advanced

Run extra commands on the entrypoint

If you need to execute some command before httpd starts (i.e. a cron daemon inside the container), you can bind-mount a file /usr/local/bin/autorun.sh that will be executed during the entrypoint. Add the following volume

...
    --volume /path/to/my/autorun.sh:/usr/local/bin/autorun.sh:ro
...

Analyze old log files

Awstats only processes lines in log files that are newer than the newest already known line. 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/*

LOGFILES=(
    "gunzip -c /var/local/log/access.log.52.gz |"
    "gunzip -c /var/local/log/access.log.51.gz |"
    "gunzip -c /var/local/log/access.log.50.gz |"
    "gunzip -c /var/local/log/access.log.49.gz |"
    "gunzip -c /var/local/log/access.log.48.gz |"
    "gunzip -c /var/local/log/access.log.47.gz |"
    "gunzip -c /var/local/log/access.log.46.gz |"
    "gunzip -c /var/local/log/access.log.45.gz |"
    "gunzip -c /var/local/log/access.log.44.gz |"
    "gunzip -c /var/local/log/access.log.43.gz |"
    "gunzip -c /var/local/log/access.log.42.gz |"
    "gunzip -c /var/local/log/access.log.41.gz |"
    "gunzip -c /var/local/log/access.log.40.gz |"
    "gunzip -c /var/local/log/access.log.39.gz |"
    "gunzip -c /var/local/log/access.log.38.gz |"
    "gunzip -c /var/local/log/access.log.37.gz |"
    "gunzip -c /var/local/log/access.log.36.gz |"
    "gunzip -c /var/local/log/access.log.35.gz |"
    "gunzip -c /var/local/log/access.log.34.gz |"
    "gunzip -c /var/local/log/access.log.33.gz |"
    "gunzip -c /var/local/log/access.log.32.gz |"
    "gunzip -c /var/local/log/access.log.31.gz |"
    "gunzip -c /var/local/log/access.log.30.gz |"
    "gunzip -c /var/local/log/access.log.29.gz |"
    "gunzip -c /var/local/log/access.log.28.gz |"
    "gunzip -c /var/local/log/access.log.27.gz |"
    "gunzip -c /var/local/log/access.log.26.gz |"
    "gunzip -c /var/local/log/access.log.25.gz |"
    "gunzip -c /var/local/log/access.log.24.gz |"
    "gunzip -c /var/local/log/access.log.23.gz |"
    "gunzip -c /var/local/log/access.log.22.gz |"
    "gunzip -c /var/local/log/access.log.21.gz |"
    "gunzip -c /var/local/log/access.log.20.gz |"
    "gunzip -c /var/local/log/access.log.19.gz |"
    "gunzip -c /var/local/log/access.log.18.gz |"
    "gunzip -c /var/local/log/access.log.17.gz |"
    "gunzip -c /var/local/log/access.log.16.gz |"
    "gunzip -c /var/local/log/access.log.15.gz |"
    "gunzip -c /var/local/log/access.log.14.gz |"
    "gunzip -c /var/local/log/access.log.13.gz |"
    "gunzip -c /var/local/log/access.log.12.gz |"
    "gunzip -c /var/local/log/access.log.11.gz |"
    "gunzip -c /var/local/log/access.log.10.gz |"
    "gunzip -c /var/local/log/access.log.9.gz |"
    "gunzip -c /var/local/log/access.log.8.gz |"
    "gunzip -c /var/local/log/access.log.7.gz |"
    "gunzip -c /var/local/log/access.log.6.gz |"
    "gunzip -c /var/local/log/access.log.5.gz |"
    "gunzip -c /var/local/log/access.log.4.gz |"
    "gunzip -c /var/local/log/access.log.3.gz |"
    "gunzip -c /var/local/log/access.log.2.gz |"
    "/var/local/log/access.log.1"
    "/var/local/log/access.log"
)
for lf in "${LOGFILES[@]}"; do
    docker exec awstats /usr/lib/awstats/cgi-bin/awstats.pl -update -config=my_website -LogFile="$lf"
done

kub-awstat's People

Contributors

iberejr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.