Upload files to "/"

This commit is contained in:
2026-07-23 01:06:33 +00:00
parent 79c085b613
commit b061ae5f0c
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
##FAIL2BAN LOG ANALYZER
set -euo pipefail
clear
##CONFIG
log="${1:-/var/log/fail2ban.log}"
##CHECK
if [[ ! -f "$log" ]]; then
echo "Error: File not found: $log" >&2
exit 1
fi
##RUN
echo "==========================="
echo "FAIL2BAN DAILY TOTALS "
echo "==========================="
awk '
{
##FIELDS: $1 = date (YYYY-MM-DD), $2 = time
if ($1 ~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) {
counts[$1]++
}
}
END {
n = asorti(counts, sorted, "@ind_str_asc")
for (i = 1; i <= n; i++) {
printf "%s %6d\n", sorted[i], counts[sorted[i]]
}
}
' "$log" | column -t -R 2
echo "---------------------------"
tot=$(wc -l < "$log" | tr -d ' ')
echo "==========================="
printf "Total: %s lines\n" "$tot"