How do I parse all 404's from my weblogs

grep ' 404 ' /var/log/nginx/access.log* | awk '{print $7}' | sort -n | uniq -c | sort -rn > /root/top404.txt

This will find, group, count and sort by count descending for all non compressed log files. Note that the print $7 is the column number delineated by spaces. You may have to experiment with the index number based on log settings.