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
This commit is contained in:
cschantz
2025-11-03 20:33:27 -05:00
parent d7febf68d3
commit 87f611da46
+20 -4
View File
@@ -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")