A Linux host's /var/log/auth.log holds SSH entries such as "Failed password for root from 203.0.113.5 port 22 ssh2". Which shell pipeline ranks source IPs by number of failed logins?
Show the answer
Correct answerC. grep "Failed password" /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn
AWhy not this: Fields 1 and 2 are the month and day, so this ranks failures by date, not by source IP.
BWhy not this: This is PowerShell syntax that groups whole lines, so each line is unique and no per-IP count results.
CWhy this is right: grep filters failures, awk pulls the IP field, and sort | uniq -c | sort -rn counts and ranks each address.
DWhy not this: grep -c outputs one total number, so there are no IPs left to group or rank.
The pipeline filters failed lines, extracts the IP with awk (fourth field from the end), then sort and uniq -c count each address and sort -rn ranks them. The timestamp version looks similar but counts failures per date, not per IP.