summaryrefslogtreecommitdiff
path: root/history.sh
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-10-01 20:35:47 +0000
committerdoc <doc@filenotfound.org>2025-10-01 20:35:47 +0000
commit772152a5810aa8c4e03cf167381aadc4ec00499f (patch)
treeba9418142f88622da878d9a3483c5da2da3e5c83 /history.sh
parent13eb2d51c7284472efabc278bf9b7ec0b8575e47 (diff)
mirror scriptsHEADmaster
Diffstat (limited to 'history.sh')
-rwxr-xr-xhistory.sh32
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"