From 87f611da46a8c87359ae31cf1aba0c7fba90ac70 Mon Sep 17 00:00:00 2001 From: cschantz Date: Mon, 3 Nov 2025 20:33:27 -0500 Subject: [PATCH] Add 30-day option to Fast 500 Error Tracker - Added time range selection: 24 hours, 7 days, 30 days - Default still 24 hours for speed - Uses same time filtering as full analyzer --- modules/website/500-error-tracker.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) 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")