Updated Files
هذا الالتزام موجود في:
@@ -7,26 +7,20 @@ if [[ ! -f "$LOG_FILE" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📊 Fruit API Log Report - $(date)"
|
||||
echo "-----------------------------------------"
|
||||
echo "📊 Fruit API Logs Report (last 2 hours) - $(date)"
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
# Time format for the last hour
|
||||
last_hour=$(date --date='1 hour ago' +"%Y-%m-%d %H")
|
||||
# Get timestamps from last 2 hours
|
||||
time_filter=$(date --date='2 hours ago' +"%Y-%m-%d %H")
|
||||
|
||||
echo "🔹 Logs from last hour ($last_hour:*):"
|
||||
echo ""
|
||||
# Show all logs from last 2 hours
|
||||
echo "🔹 Raw logs (last 2 hours):"
|
||||
grep "$time_filter" "$LOG_FILE"
|
||||
|
||||
# Status codes
|
||||
echo "✅ Status codes count:"
|
||||
grep "$last_hour" "$LOG_FILE" | grep "RESPONSE" | awk '{print $6}' | cut -d'=' -f2 | sort | uniq -c | sort -nr
|
||||
echo ""
|
||||
echo "--------------------------------------------------"
|
||||
echo "🔹 Status Codes Summary:"
|
||||
grep "$time_filter" "$LOG_FILE" | grep "RESPONSE" | awk '{print $NF}' | sort | uniq -c | sort -nr
|
||||
|
||||
# Top IPs
|
||||
echo "🌍 Top Client IPs:"
|
||||
grep "$last_hour" "$LOG_FILE" | grep "REQUEST" | awk '{for(i=1;i<=NF;i++){if($i ~ /^ip=/){print $i}}}' | cut -d'=' -f2 | sort | uniq -c | sort -nr
|
||||
echo ""
|
||||
|
||||
# Endpoints
|
||||
echo "📂 Endpoints accessed:"
|
||||
grep "$last_hour" "$LOG_FILE" | grep "REQUEST" | awk '{for(i=1;i<=NF;i++){if($i ~ /^path=/){print $i}}}' | cut -d'=' -f2 | sort | uniq -c | sort -nr
|
||||
echo "-----------------------------------------"
|
||||
echo "--------------------------------------------------"
|
||||
echo "🔹 Users & IPs:"
|
||||
grep "$time_filter" "$LOG_FILE" | grep "REQUEST" | awk '{for(i=1;i<=NF;i++){if($i ~ /^ip=/){print $i}}}' | sort | uniq -c | sort -nr
|
||||
|
المرجع في مشكلة جديدة
حظر مستخدم