Log Analysis Tool

#!/bin/bash

logfile="access.log"

echo "Analyzing $logfile for failed login attempts..."
grep "401" "$logfile" | awk '{print $1}' | sort | uniq -c | sort -nr > failed_logins.txt

echo "Failed login attempts saved to failed_logins.txt."