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.
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.13.tar.gz
(22.9 kB
view details)
Built Distribution
File details
Details for the file a9x_webstatistics-1.1.13.tar.gz
.
File metadata
- Download URL: a9x_webstatistics-1.1.13.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eee088e48adda38a401a769e11b04db094e0b49be27616519d969d551bae0c3 |
|
MD5 | 137f7992ac271d4b0df2658948c9d6ba |
|
BLAKE2b-256 | 4f97aed7efcef9e9a5bd7605164f98daaf4bae73eb41eba207d6c2743058a5d6 |
File details
Details for the file a9x_webstatistics-1.1.13-py3-none-any.whl
.
File metadata
- Download URL: a9x_webstatistics-1.1.13-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e9a0bc2f107abe160d89aa07785c60fcbcefc03bacff2a80ab3590e46818d70 |
|
MD5 | 4e421dcde0d8b36e9f534bf3fbe92d48 |
|
BLAKE2b-256 | 74adf29052f3d4add616dddd2dbefd70ca83b389915d1ef9a32254b30b2ea747 |