~/bpabatao
← back to index

Observability & Accountability

How a small team answers questions about its fleet: who changed what, and which accounts look wrong.

Role
Sole author
Period
2026
Stack
MongoDB · CloudWatch · WAFv2 · Fastify · React
tenant portalscore apiproviderscapture layeraccount to ip fan-outtakeover alertadmin writeskept 365 daysadmin readskept 90 daystelemetrykept 90 days
Portals, the core API and outbound providers feed one capture layer that deep-redacts payloads on v2, raises anomaly alerts, and writes to retention tiers

Problem

A fleet of tenant portals produced plenty of logs, and answering a question from them meant someone reading raw streams. The questions were ordinary ones: which admin changed an account, whether a login pattern was normal, whether an error rate was real or the same benign auth failure counted a thousand times.

Constraints

This is utility customer data, which limits how long it can be kept and who can read it. The dashboard had to be usable during an incident by whoever was responding, and it had to fit the platform's existing cost budget.

Decisions

Architecture

A wrapper records calls out to identity, mail, payment and billing providers alike, so an event exists whether the failure was ours or theirs. On the v2 capture path payloads are deep-redacted: tokens, passwords and identifiers. Measured volume is 156,656 events a day at 1.8 KB each, projected to about 35 GB at steady state.

Accountability is tiered. Admin writes record which fields changed and are kept for a year. On the v2 API, admin reads and impersonated sessions are captured too, attributed to the acting admin, and kept for ninety days.

An account-to-IP fan-out view surfaces anomalies, and an alert fires on a suspicious email-change pattern.

A composite index on tenant, environment, user and timestamp cut the sessions view 43x, and Bedrock spend is attributed to its own client in the cost dashboard so AI cost is visible next to everything else. A scheduled analyzer groups errors by code and endpoint and sends each pattern to Bedrock once, re-analyzing only when it spikes, spreads to more users or goes stale.

Outcome

view resume ↗ (opens in new tab)email me