diff --git a/modules/security/bot-analyzer.sh b/modules/security/bot-analyzer.sh index 82f6f43..aed4923 100755 --- a/modules/security/bot-analyzer.sh +++ b/modules/security/bot-analyzer.sh @@ -352,6 +352,9 @@ parse_logs() { # Parse all domain logs (excluding -bytes_log, .offset, and error_log files) # cPanel creates files like: domain.com, domain.com-ssl_log + local file_count=0 + local progress_interval=50 + echo "" find "$LOG_DIR" -type f ! -name "*-bytes_log" ! -name "*.offset" ! -name "*error_log" "${find_opts[@]}" 2>/dev/null | while read -r logfile; do # Skip empty files [ -s "$logfile" ] || continue @@ -365,6 +368,12 @@ parse_logs() { fi fi + # Show progress every N files + file_count=$((file_count + 1)) + if [ $((file_count % progress_interval)) -eq 0 ]; then + echo -ne "\r Parsed $file_count log files... (current: $domain)" + fi + # Parse Apache Combined Log Format with error handling # Format: IP - - [timestamp] "METHOD URL PROTOCOL" STATUS SIZE "REFERRER" "USER-AGENT" awk -v domain="$domain" ' @@ -411,6 +420,9 @@ parse_logs() { }' "$logfile" >> "$TEMP_DIR/parsed_logs.txt" 2>/dev/null done + # Clear the progress line + echo -ne "\r\033[K" + if [ ! -s "$TEMP_DIR/parsed_logs.txt" ]; then print_alert "No log entries were parsed. Check log format or permissions." return 1