Skip to content

Commit

Permalink
add a script to generate a log-based analytics dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Dec 23, 2020
1 parent edaca74 commit 770757c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gitea/traffic.sh
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

SSH_HOST="${1:-}"
VHOST="${2:-}"

if test -z "$SSH_HOST"; then
echo "Usage: ${0:-} SSH_HOST VHOST"
exit 1
elif test -z "$VHOST"; then
echo "Usage: ${0:-} ${SSH_HOST} VHOST"
echo "(vhost was missing)"
exit 1
fi

ssh "$SSH_HOST" "grep -e '^${VHOST}:' /var/log/nginx/access.log | goaccess --log-format=VCOMBINED -" > report.html
open report.html

0 comments on commit 770757c

Please sign in to comment.