commit b2ad482e8fce2a60f891fd27b6c388628b2fa879 Author: Radar231 Date: Thu Sep 9 09:09:34 2021 -0400 initial checkin diff --git a/README.md b/README.md new file mode 100644 index 0000000..3919d35 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# mkwebstats repo + +## Introduction + +This repo contains mkwebstats.sh, a simple shell script that will use goaccess +to generate web log analytics from nginx-proxy-manager proxy host logs. The +resultant html report files will be written into the html directory of another +nginx web host. + +This instance of goaccess has IP geolocation enabled, and requires the presence +of a GeoLite2 geo ip database from MaxMind (https://www.maxmind.com). + diff --git a/mkwebstats.sh b/mkwebstats.sh new file mode 100755 index 0000000..876f719 --- /dev/null +++ b/mkwebstats.sh @@ -0,0 +1,118 @@ +#!/bin/bash +##################################################################### +# +# This is a simple shell script that will use goaccess to generate web +# log analytics from nginx-proxy-manager proxy host logs. The resultant +# html report files will be written into the html directory of another +# nginx web host. +# +# This instance of goaccess has IP geolocation enabled, and requires +# the presence of a GeoLite2 geo ip database from MaxMind +# (https://www.maxmind.com). +# +##################################################################### + +##################################################################### +# variable definitions + +# today's date, in logfile format +dateToday=$(date +"%0d/%b/%Y") + +# log dir +logDir="${HOME}/docker/docker_nginx-proxy-manager/data/logs" + +# goaccess binary +goBin="/usr/local/bin/goaccess" + +# destination dir +dstDir="${HOME}/docker/docker_nginx-go.delfax.net/go.delfax.net/html" + +# set up our array of 'hostname:logfile' +declare logfiles + +# array entries for hostname:logfile +logfiles=("delfax.net:proxy-host-1_access.log" \ + "www.delfax.net:proxy-host-9_access.log" \ + "radar231.com:proxy-host-4_access.log" \ + "www.radar231.com:proxy-host-10_access.log" \ + "git.radar231.com:proxy-host-5_access.log" \ + "go.delfax.net:proxy-host-14_access.log" \ + "npm.delfax.net:proxy-host-6_access.log" \ + "jmc.delfax.net:proxy-host-7_access.log" \ + ) + +# goaccess args +geoipArg="${HOME}/bin/GeoLite2-City/GeoLite2-City.mmdb" +timeArg='%H:%M:%S' +dateArg='%d/%b/%Y' +# a format string structured for nginx-proxy-manager proxy host logs +formatArg='[%d:%t %^] %^ %^ %s - %m %^ %v %U [Client %h] [Length %b] [Gzip %^] [Sent-to %^] %u %R' + +##################################################################### +# We'll create an index.html file that contains links to all of our +# generated report files + +# create the header for our index.html +cat >${dstDir}/index.html < + + + goaccess index + + +

+

+

NPM Proxy Host Web Analytic Reports

+
+

+


+

+