Free lab Real Python 3. Zero installs. Your code stays in this browser. Open the playground

Server Log Analyzer

Turn a raw access log into the report an on-call engineer actually reads: request volume, error rate, per-endpoint traffic and p95 latency — the same four numbers every observability dashboard leads with.

Intermediate 4 steps 110 XP ~40 min

How it works in the real world

Every monitoring tool — Datadog, Grafana, CloudWatch — runs this pipeline over your logs:

  1. Parse — split unstructured log lines into typed fields.
  2. Aggregate — group by endpoint and count requests and failures.
  3. Summarise — collapse thousands of latencies into percentiles, because an average hides the slow tail that users feel.
  4. Report — rank the endpoints so the worst offender is on the first line.

You'll build all four stages. p95 is the number that matters: it means 95% of requests were faster, so it captures the pain an average smooths away.

Build progress0 / 4 steps
1

Parse and count failures

Split each log line into method path status ms. Print the request count, how many had a status of 400 or more, and the error rate to one decimal.

Blank · autosaved
PYstep_1.py
Run your code to check this step…
2

Traffic per endpoint

Count requests per path and print path count, busiest first. Break ties alphabetically so the output is stable.

Blank · autosaved
PYstep_2.py
Run your code to check this step…
3

Latency percentiles

Write percentile(values, pct) using nearest-rank: sort, then take index ceil(pct/100 * n) - 1. Print the count, p50, p95 and max.

Blank · autosaved
PYstep_3.py
Run your code to check this step…
4

Ship the report

Combine everything into an aligned table: header === Traffic Report ===, a column row, one line per endpoint (busiest first) with requests, errors and p95, then a TOTAL row.

Blank · autosaved
PYstep_4.py
Run your code to check this step…
Your next ten minutes

Write Python that does something useful.

Start free. No install, no card, no passive video marathon.

Start learning free → Explore the path