Fix duplicate diagnostics and integer expression error in 500 tracker
Issues fixed: - Removed duplicate diagnostic messages (was showing same error 169+ times) - Fixed bash integer expression error at line 552 - Deduplicate diagnostics by domain+url+issue combination using sort -u - Only save diagnostics when we have an actual identified cause - Skip displaying UNKNOWN causes (these are now categorized as NO_PHP_ERROR_LOGGED) - Show "X unique issues" instead of raw count to reflect deduplication Now shows each unique domain+issue combination once, with proper counts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -322,13 +322,17 @@ while IFS='|' read -r domain user status url timestamp ip; do
|
|||||||
[ -n "$specific_file" ] && diagnosis="$diagnosis - from file: $specific_file"
|
[ -n "$specific_file" ] && diagnosis="$diagnosis - from file: $specific_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save detailed diagnosis
|
# Save detailed diagnosis only if we identified a specific cause
|
||||||
|
if [ "$cause" != "UNKNOWN" ] && [ -n "$diagnosis" ]; then
|
||||||
echo "$cause|$diagnosis" >> "$DETAILED_DIAGNOSIS"
|
echo "$cause|$diagnosis" >> "$DETAILED_DIAGNOSIS"
|
||||||
((diagnosed_causes["$cause"]++))
|
((diagnosed_causes["$cause"]++))
|
||||||
[ -z "${cause_examples[$cause]}" ] && cause_examples["$cause"]="$diagnosis"
|
[ -z "${cause_examples[$cause]}" ] && cause_examples["$cause"]="$diagnosis"
|
||||||
else
|
else
|
||||||
((diagnosed_causes["NO_PHP_ERROR_LOGGED"]++))
|
((diagnosed_causes["NO_PHP_ERROR_LOGGED"]++))
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
((diagnosed_causes["NO_PHP_ERROR_LOGGED"]++))
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# No error log found - check .htaccess and permissions thoroughly
|
# No error log found - check .htaccess and permissions thoroughly
|
||||||
if [ "$user" != "unknown" ]; then
|
if [ "$user" != "unknown" ]; then
|
||||||
@@ -510,6 +514,9 @@ done | sort -rn | while IFS='|' read count cause; do
|
|||||||
echo -e "${YELLOW}$clean_cause${NC} - $count occurrences"
|
echo -e "${YELLOW}$clean_cause${NC} - $count occurrences"
|
||||||
echo -e " ${YELLOW}Note:${NC} 500 error but no PHP error in log - likely .htaccess or Apache config"
|
echo -e " ${YELLOW}Note:${NC} 500 error but no PHP error in log - likely .htaccess or Apache config"
|
||||||
;;
|
;;
|
||||||
|
UNKNOWN)
|
||||||
|
# Skip - these are errors we couldn't diagnose
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${INFO_COLOR}$clean_cause${NC} - $count occurrences"
|
echo -e "${INFO_COLOR}$clean_cause${NC} - $count occurrences"
|
||||||
;;
|
;;
|
||||||
@@ -544,17 +551,20 @@ echo " SPECIFIC DIAGNOSTICS (per URL/file)"
|
|||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Show detailed diagnostics grouped by cause
|
# Show detailed diagnostics grouped by cause - deduplicate by domain+url+issue
|
||||||
if [ -f "$DETAILED_DIAGNOSIS" ] && [ -s "$DETAILED_DIAGNOSIS" ]; then
|
if [ -f "$DETAILED_DIAGNOSIS" ] && [ -s "$DETAILED_DIAGNOSIS" ]; then
|
||||||
for cause_type in PHP_MEMORY_EXHAUSTED PERMISSION_ERROR HTACCESS_ERROR PHP_FATAL_ERROR PHP_SYNTAX_ERROR MISSING_PHP_FUNCTION DATABASE_CONNECTION; do
|
for cause_type in PHP_MEMORY_EXHAUSTED PERMISSION_ERROR HTACCESS_ERROR PHP_FATAL_ERROR PHP_SYNTAX_ERROR MISSING_PHP_FUNCTION DATABASE_CONNECTION; do
|
||||||
cause_count=$(grep -c "^${cause_type}|" "$DETAILED_DIAGNOSIS" 2>/dev/null || echo "0")
|
# Get unique diagnostics (deduplicate identical domain+issue combinations)
|
||||||
|
unique_diags=$(grep "^${cause_type}|" "$DETAILED_DIAGNOSIS" 2>/dev/null | cut -d'|' -f2 | sort -u)
|
||||||
|
cause_count=$(echo "$unique_diags" | grep -c "^" 2>/dev/null || echo "0")
|
||||||
|
|
||||||
if [ "$cause_count" -gt 0 ]; then
|
if [ "$cause_count" -gt 0 ] && [ -n "$unique_diags" ]; then
|
||||||
cause_display=$(echo "$cause_type" | tr '_' ' ')
|
cause_display=$(echo "$cause_type" | tr '_' ' ')
|
||||||
echo -e "${RED}${BOLD}$cause_display ($cause_count)${NC}"
|
echo -e "${RED}${BOLD}$cause_display ($cause_count unique issues)${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
grep "^${cause_type}|" "$DETAILED_DIAGNOSIS" | cut -d'|' -f2 | head -20 | while read -r diag_line; do
|
echo "$unique_diags" | head -20 | while read -r diag_line; do
|
||||||
|
[ -z "$diag_line" ] && continue
|
||||||
echo -e " ${YELLOW}•${NC} $diag_line"
|
echo -e " ${YELLOW}•${NC} $diag_line"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user