Per-Endpoint Latency Percentiles From Raw Web Server Access Logs

Last updated: November 29, 2026

Quick Overview

Given raw access log lines in a fixed format (client, quoted request line, status, latency in ms), group requests by method and normalized endpoint (numeric path segments replaced by {id}, query strings dropped) and report count, p50, p99, and 5xx error rate per endpoint, skipping malformed lines.

Google
Coding & Algorithms
Data Engineer
Google
November 29, 2026
Data Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given raw access log lines in a fixed format (client, quoted request line, status, latency in ms), group requests by method and normalized endpoint (numeric path segments replaced by {id}, query strings dropped) and report count, p50, p99, and 5xx error rate per endpoint, skipping malformed lines.

Google SRE and data engineering screens like questions that combine parsing with aggregation, the way a monitoring pipeline turns logs into dashboards. The interviewer looks for a strict line parser, sensible endpoint normalization, a defined percentile method, and a count of rejected lines instead of silent drops.

What the Interviewer Expects
  • Uses a precise regular expression and counts lines that fail to match
  • Normalizes endpoints by dropping query strings and templating IDs
  • Defines the percentile method (nearest rank) and implements it correctly
  • Computes error rate from 5xx statuses per endpoint
  • Discusses streaming percentiles when data is too large to sort
Key Topics to Cover
Log Parsing
Regular Expressions
Percentiles
Aggregation
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Logs are terabytes per day; how would you compute p99 approximately in a streaming job?
  • IDs are UUIDs or base64 slugs rather than numbers; how do you template them?
  • How would you merge percentile summaries computed on different machines?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Line format: 10.0.0.1 "GET /api/users/42?x=1 HTTP/1.1" 200 12ms.
  • Group key: method plus path with query removed and all-digit segments replaced by {id}.
  • Output per key: count, p50, p99...
High-Level Design

Parse strictly with one compiled regex that captures method, path, status, and latency; anything that does not match is counted as skipped. Normalize the path, append the latency to a list for that ke...


Submit Your Answer
Markdown supported