awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -10

Category: Web Servers & Proxies

awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -10

Show the most common HTTP status codes in nginx logs

Field 9 of the nginx access log is the status code, so this pipeline shows how many 200s, 404s, and 5xx responses the server returned. A sudden spike of 502 or 503 points to backend or proxy problems. The same pattern works on Apache logs, where the status field is also 9.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.