Your question is Top Five Frequent Error Logs. 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.
In Meta infrastructure systems, engineers often need to summarize large volumes of Scuba-style server logs. Given a list of log lines, return the top 5 most frequent error messages.
A log line is considered an error message only if it starts with the prefix "ERROR: ". The message is the substring after that prefix. Count identical messages together and return up to 5 messages ordered by descending frequency. If two messages have the same frequency, return them in lexicographically ascending order.
Implement a function that takes a list of strings logs and returns a list of strings.
logs, a list of log linesIgnore all non-error log lines.
def top_five_errors(logs):