Update fail2ban_log2json.sh

added regex

(^|[^A-Za-z])

to avoid using incorrect ban or unban events.
This commit is contained in:
SubleXBle
2025-08-20 10:42:11 +02:00
committed by GitHub
parent 6acc5e92f2
commit d724dff1bb

View File

@@ -13,7 +13,7 @@ mkdir -p "$OUTPUT_JSON_DIR"
# === Processing ===
echo "[" > "$OUTPUT_JSON_FILE"
grep -E "Ban |Unban " "$LOGFILE" | awk -v today="$TODAY" '
grep -E "(^|[^A-Za-z])(Ban|Unban) " "$LOGFILE" | awk -v today="$TODAY" '
{
timestamp = $1 " " $2;