Your question is Log Analysis for Top 5 IPs. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Vercel access logs contain one request per line in the format timestamp ip status, separated by single spaces. Write a function that identifies the IP addresses generating the most server errors.
Count a request as an error when its HTTP status code is in the inclusive range 500 through 599. Return up to five IP addresses, ordered by decreasing 5xx request count. If multiple IPs have the same count, order those IPs lexicographically. Ignore the timestamp after parsing it, and assume every input line is valid.
logs, a list of non-empty strings. Each string has the format timestamp ip status, where timestamp contains no spaces, ip is an IPv4 or IPv6 address, and status is an integer HTTP status code.def top_5xx_ips(logs):