diff --git a/modules/website/500-error-tracker.sh b/modules/website/500-error-tracker.sh index 132fef4..8c133d2 100755 --- a/modules/website/500-error-tracker.sh +++ b/modules/website/500-error-tracker.sh @@ -16,6 +16,26 @@ echo "" echo "Scanning for 500 errors and diagnosing root causes..." echo "" +# Ask for time range +echo -e "${CYAN}How far back to scan?${NC}" +echo " 1) Last 24 hours (default)" +echo " 2) Last 7 days" +echo " 3) Last 30 days" +echo "" +read -p "Select option [1]: " time_choice +time_choice=${time_choice:-1} + +case $time_choice in + 1) HOURS_TO_SCAN=24 ;; + 2) HOURS_TO_SCAN=168 ;; + 3) HOURS_TO_SCAN=720 ;; + *) HOURS_TO_SCAN=24 ;; +esac + +echo "" +echo "→ Scanning last $HOURS_TO_SCAN hours of access logs..." +echo "" + # Temporary files TEMP_DIR="/tmp/500-tracker-$$" mkdir -p "$TEMP_DIR" @@ -26,10 +46,6 @@ ERROR_DETAILS="$TEMP_DIR/error_details.txt" # Configuration DOMLOGS_DIR="/var/log/apache2/domlogs" -HOURS_TO_SCAN=24 - -echo "→ Scanning last $HOURS_TO_SCAN hours of access logs..." -echo "" # Get cutoff time cutoff_time=$(date -d "$HOURS_TO_SCAN hours ago" +%s 2>/dev/null || echo "0")