Your question is Parsing Audit Logs for Anomalies. 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.
Write a script or function to parse large cloud audit logs and flag anomalous access patterns.
Each input line has the format timestamp,user_id,ip,action, with integer timestamps in nondecreasing order. Return the zero-based indices of events where the user has accessed from more than max_unique_ips distinct IP addresses within the inclusive preceding window_seconds interval. Inputs are valid, and the result must preserve log order.
def flag_anomalous_access(log_lines, window_seconds, max_unique_ips):