Design a Database Activity Monitoring

Medium45 min
1 / 30
System design answer

Design a Database Activity Monitoring

Medium45 min30 sections
understanding•11 min read

Problem Statement: Why Native DB Logs Are Not Enough

Frames Database Activity Monitoring as a security control plane, not a log tailer, and separates detection, evidence, and compliance duties.

Problem statement

Design a Database Activity Monitoring (DAM) platform that captures every query and transaction executed across a fleet of relational and NoSQL databases, evaluates that activity against security policy and behavioral baselines in near real time, records privileged-user activity with full forensic detail, and retains tamper-evident evidence long enough to satisfy regulated-industry audit requirements. The system must raise alerts when policy is violated, expose dashboards and search for analysts, and integrate with the enterprise SIEM and SOAR tooling.

This is not "turn on database logging and ship it to a dashboard." Native database audit facilities are designed for the database's own correctness and accountability, not for enterprise-wide security detection. They differ wildly in schema, verbosity, and performance cost; they live inside the system an attacker already has credentials to; and they can usually be disabled or truncated by a privileged user. A DAM platform exists precisely because the security team cannot trust the monitored system to police itself.

Why the problem is distinctive

A web-application backend can drop a log line when it is busy. An audit pipeline cannot. The design therefore separates three duties that are easy to blur:

  1. Capture fidelity: the platform must see the activity even when the database is misconfigured, when a connection bypasses the application tier, or when a privileged account runs directly. Missing an event is a detection gap.
  2. Detection latency: a privileged account dumping an entire customer table must be caught while the session is still live, ideally in under five seconds, so access can be revoked. A report generated the next morning is forensics, not defense.
  3. Evidence integrity: the audit record itself becomes regulated data. It must be append-only, tamper-evident, encrypted, and retained for years, and the people who administer the databases must not be the people who can edit the audit trail.

The problem requires real-time or near-real-time query capture, policy and anomaly detection for suspicious commands, detailed privileged-user logging, and PII-aware masking, all while keeping performance overhead on the database acceptable, scaling to large clusters and high QPS, protecting the logs themselves, and meeting compliance regimes.

Public operating baseline versus design assumptions

Public evidence establishes that this category is operationally real and commercially mature. IBM Guardium, Imperva (now part of Thales) Data Security, Oracle Audit Vault and Database Firewall, and the cloud-native offerings AWS RDS Data Activity Streaming, Azure SQL Auditing with Microsoft Defender for SQL, and Google Cloud SQL audit logging all describe production deployments that capture database activity at scale and feed policy engines and SIEMs. These are cited product categories, not requirements for our fictional system.

For capacity planning, this answer explicitly assumes a mature enterprise estate with 500 database instances across 40 clusters, an aggregate peak throughput of 200,000 queries per second, 100 percent capture of security-relevant statements, and a five-times event burst factor during batch windows and month-end close. Unless a number is tied to a public product capability, it is a stated design assumption, target, budget, or illustrative threshold, not a claim about any vendor's private architecture.

The four architectural planes

  1. Capture plane: agents, network taps, native audit streams, and database-native activity streaming that observe statements and sessions with minimal interference to the database.
  2. Detection plane: normalization, enrichment, policy evaluation, anomaly scoring, and alert correlation that turn raw events into findings.
  3. Evidence plane: append-only, tamper-evident, encrypted, retained storage that serves compliance queries, investigations, and legal holds.
  4. Operations plane: dashboards, alert triage, policy authoring, SIEM/SOAR integration, and fleet administration.

A strong interview answer keeps these planes separate. It allows the operations plane to degrade without weakening capture or evidence, and it lets the detection plane improve its models without silently rewriting what the evidence plane promises to auditors.

Key Highlights

  • •The database cannot be trusted to police itself: capture, detection, and evidence must live outside the monitored system's full control.
  • •Model activity capture as a durable, loss-sensitive pipeline and motion toward detection as a latency-sensitive stream.
  • •Public product categories prove the domain is real; every uncited scale or SLO in this answer is an explicit design assumption.
  • •The architecture has four planes: capture, detection, evidence, and operations.
  • •A delayed alert is forensics; a sub-five-second alert is defense. Design for the latter, retain for the former.
Lead With the Trust Boundary
State in the first two minutes that the audit trail must be outside the full control of the database administrators it monitors. This instantly distinguishes a security control plane from a logging feature and frames every later decision.
Do Not Design a Log Shipper
A design that only forwards native database logs to a dashboard ignores capture gaps, privileged tampering, detection latency, and evidence integrity. It will fail a serious security interview.

Section Rescue Kit

Buzzwords to use:

Database Activity MonitoringSeparation of Duties

Safe statements:

  • "I will separate detection duty from evidence duty, because one is latency-sensitive and the other is integrity-sensitive."
  • "Before choosing capture technology, let me define what the security team must see even when the database is compromised."
Design a Database Activity Monitoring - System Design | WinJob | WinJob