diff options
Diffstat (limited to 'history.sh')
| -rwxr-xr-x | history.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/history.sh b/history.sh new file mode 100755 index 0000000..63b2ad4 --- /dev/null +++ b/history.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# alma-stats.sh +# Summarize AlmaLinux clients per release (daily demographic snapshot) + +LOGFILE="/var/log/nginx/stygian_access.log" +OUTFILE="/var/log/mirrors/alma-summary-$(date +%F).log" + +echo "=== AlmaLinux Mirror Client Summary ($(date)) ===" > "$OUTFILE" + +awk '$0 ~ /libdnf/ && $7 ~ /alma/ { + ip=$1 + split($7,a,"/") + ver=a[3] + key=ip" "ver + count[key]++ +} +END { + for (k in count) print count[k], k +}' "$LOGFILE" | sort -nr >> "$OUTFILE" + +# Add a little breakdown by release (ignoring IPs) +echo "" >> "$OUTFILE" +echo "=== Totals by Release ===" >> "$OUTFILE" + +awk '$0 ~ /libdnf/ && $7 ~ /alma/ { + split($7,a,"/") + ver=a[3] + count[ver]++ +} +END { + for (v in count) print count[v], v +}' "$LOGFILE" | sort -nr >> "$OUTFILE" |
