Skip to main content

Notification Audit Storage

Summary​

NotificationAuditLog is an append-only trail recording every stage an event or message passes through, keyed for correlation tracking. It is the most heavily indexed table in the schema.

Audience​

Engineers, architects, QA, support, DevOps engineers and security reviewers.

Reference Content​

The verified reference material for this topic is set out in the sections below.

Ownership​

Owned by NotificationDbContext. Written by the dispatcher's audit helper at every stage and by the read-state endpoint. Read by the audit query endpoint.

Columns​

ColumnTypeConstraint
IdGUIDPrimary key
TenantIdstringMax length 80, nullable
EventIdGUIDNullable
NotificationMessageIdGUIDNullable — null for event-level stages
EventTypestringMax length 160, nullable
StagestringMax length 40, required
DetailstringMax length 2000, nullable
CorrelationIdstringMax length 160, nullable
TraceIdstringMax length 64, nullable
OccurredOnUtctimestamp—

Indexes​

IndexColumnsUnique
IX_Audit_EventIdeventNo
IX_Audit_MessageIdmessageNo
IX_Audit_CorrelationcorrelationNo
IX_Audit_OccurredOnoccurrence timestampNo

Four single-column indexes — one for each filter the audit endpoint accepts, plus one for its ordering column.

Stages​

Thirteen stage values are defined as constants and stored as plain strings: received, duplicate, stale, template resolved, template missing, recipient resolved, suppressed, message created, delivered, delivery failed, retried, processed and read.

Twelve are written by the dispatcher across the processing pipeline; the read stage is written by the read-state API endpoint.

Write pattern​

Every audit write is its own save. The helper adds one row and immediately calls save changes, so a single event that fans out across recipients and channels produces many separate audit round-trips. Detail text is truncated in application code to the mapped maximum before the row is added.

The trace identifier is captured from the active tracing activity when one exists, linking a stored audit row to a distributed trace.

Growth​

Append-only with no cleanup. Audit volume scales with the number of events times recipients times channels times pipeline stages, and nothing removes rows. See retention.

Lifecycle​

Insert-only. No reviewed code path updates or deletes an audit row.

Classification​

Implemented.

Requires confirmation​

Whether audit retention and archival are planned requires confirmation.

See Also​

Keywords​

  • Notification database
  • Audit Storage
  • Draft database documentation

Source References​

  • microservices/src/notification-service/Infrastructure/NotificationDbContext.cs
  • microservices/src/notification-service/Domain/NotificationEntities.cs
  • microservices/src/notification-service/Application/NotificationDispatcher.cs
  • microservices/src/notification-service/Api/NotificationEndpoints.cs
  • microservices/src/notification-service/Infrastructure/Migrations/20260705113059_InitialNotificationSchema.cs

Revision Information​

  • Status: Draft
  • Last reviewed: 2026-07-21
  • Review cycle: Quarterly