Skip to main content

Web Statistics and Analytics Package

Project description

Web Statistics and Analytics

This package produces web statistics and analytical output based on nginx access log files.

PyPI package version number Actions Status License

Downloads Python

Live Example

Visit the live example on logikfabrik.com.

Installation

pip install a9x-webstatistics

Requirements on Linux / Unix

  • nginx standard access log file
  • python3.9 onwards
  • optional: maxmind db which need to be download by end user after registration

Deployment on Linux / Unix

#!/bin/sh

export LOG=/usr/local/www/webstats.log
export PATH=/usr/local/www/django5/envpy311/bin:$PATH

python3.11 -m a9x_webstatistics.main \
   --infile /var/log/nginx-access.log \
   --geoip /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
   --domain https://www.logikfabrik.com \
   --statfile /usr/local/www/lf_static/webstatsLF24.json &> $LOG

python3.11 -m a9x_webstatistics.gencockpit \
   --infile /usr/local/www/lf_static/webstatsLF24.json \
   --outfile /usr/local/www/lf_static/webstatsLF24.html &>> $LOG

Cron-Job Entry for Linux / FreeBSD:

#minute hour    mday    month   wday    who     command
13,58   *       *       *       *       dj1     /usr/local/www/cronjobs/cron_webstatistics.sh

Installation on Windows

# install on windows:

## install a virtual env for python
python -m venv c:\temp\webstatsenv

## activate env
c:\temp\webstatsenv\Scripts\activate.bat

## install a9x-webstatistics
pip install a9x-webstatistics
python -m pip install --upgrade pip
python -m pip list

Deployment on Windows

# run
c:
cd \temp
wget -URI https://www.logikfabrik.com/wlog/access.log -OutFile access.log

## active env
c:\temp\webstatsenv\Scripts\activate.bat

## create calculate statistics
## there are no country statistics created as not geoip defined
python -m a9x_webstatistics.main --infile access.log --statfile webstatsLF.json

## create html file for webstatistics
python -m a9x_webstatistics.gencockpit --infile webstatsLF.json --outfile webstatsLF.html

Extended Example

#!/bin/sh

export LOG=/usr/local/www/webstats.log
export PATH=/usr/local/www/django5/envpy311/bin:$PATH

_YEARNUM="$(date +'%Y')";
_MONTHNUM="$(date +'%m')";

# make a archive copy for every month:
cp /usr/local/www/lf_static/webstatsLF24.json /usr/local/www/lf_static/webstatsLF24$_YEARNUM$_MONTHNUM.json
cp /usr/local/www/lf_static/webstatsLF24.html /usr/local/www/lf_static/webstatsLF24$_YEARNUM$_MONTHNUM.html

# updates all packages:
pip install -U `pip list --outdated | awk 'NR > 2 {print $1}'` >> $LOG


python3.11 -m a9x_webstatistics.main \
   --infile /var/log/nginx-access.log \
   --geoip /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
   --domain https://www.logikfabrik.com \
   --statfile /usr/local/www/lf_static/webstatsLF24.json &> $LOG

python3.11 -m a9x_webstatistics.gencockpit \
   --infile /usr/local/www/lf_static/webstatsLF24.json \
   --outfile /usr/local/www/lf_static/webstatsLF24.html &>> $LOG

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a9x_webstatistics-1.1.19.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

a9x_webstatistics-1.1.19-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file a9x_webstatistics-1.1.19.tar.gz.

File metadata

  • Download URL: a9x_webstatistics-1.1.19.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for a9x_webstatistics-1.1.19.tar.gz
Algorithm Hash digest
SHA256 440599f4af9954266db88ad66b4d03a497a898e34fdd9ba2f7df4b2960c47046
MD5 cf626617a07a20d02b3b290c4e16b390
BLAKE2b-256 55aff4d8819c82cf8a0998089ac8c285c2288d0c066e0ee9b6af8e105d83ae70

See more details on using hashes here.

File details

Details for the file a9x_webstatistics-1.1.19-py3-none-any.whl.

File metadata

File hashes

Hashes for a9x_webstatistics-1.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 d572d45973910e231fd9b871f0a0400e23f820a82c25ff2863e0504114c414f5
MD5 1e945ad039191caa24d5c57ddc7c8443
BLAKE2b-256 f24e59534c8c41158fa538a118ec18f336567e2b074362df4841001b7fb62852

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page