Skip to main content
Blog
Security6 min read

Audit log completeness testing across an API and worker

Reconcile business actions to audit records across a distributed workflow, including denied requests, retries, collector failure, and a reviewable handover decision.

Rainier Software Solutions

Rose-colored API, queue and worker nodes feed a separate audit record, with one missing event highlighted.

How do you test whether an application's audit log is complete? Start with a defined set of actions and outcomes, predict the records each one should create, then compare that expectation with the records actually retrievable from the review system. Include denied actions, delayed worker results, retries, and a logging outage. An HTTP success response and a full-looking log dashboard do not establish that every required event arrived.

This is an acceptance worksheet for engineering leads and prime contractors receiving an application or integration. It proposes a test method, not a declaration that a particular control is required for every system or that Rainier has run this test for a named client. NIST SP 800-92 treats log management as an enterprise process; the exact event set, retention, review permissions, and acceptance authority must come from the work package and applicable requirements.

Define the event contract before creating test data

An audit event is a record intended to explain an important business or security action after it happened. A diagnostic trace can help investigate a bug, but a request trace alone may not say whether a worker eventually made the change. OWASP's Logging Cheat Sheet recommends deciding which events to log and recording context such as when, where, who, what, and outcome. It also calls for testing logging behavior and failure modes. Use those prompts to specify the event contract for this product, rather than treating the cheat sheet as a universal list of mandatory events.

For each workflow, record the source of truth for the action, the expected event type, and the point where the outcome is known. A request accepted for background work is not the same outcome as work completed. In an event-driven system, Microsoft recommends propagating a correlation ID so related operations can be connected across producers and consumers. Use a server-created workflow or activity ID and a stable job ID; timestamps alone can misjoin concurrent work.

BoundarySource of truth to compareProposed audit record
API denies an unauthorized actionAuthorization decision and unchanged business stateActor or service identity, tenant, target, action, denial and policy reason
API accepts workDurable request or job recordAccepted request, workflow ID and target; do not call it completed
Worker changes stateTransaction or domain resultCompleted or failed action, outcome, target and workflow ID
Worker retries deliveryAttempt and final business stateAttempt detail where required; one clear final outcome for the logical action
Audit collector receives recordsProducer and collector counts plus record IDsReceipt or gap evidence, not an invented business success

These rows are proposed acceptance criteria. Whether a denied action, a retry attempt, or a read needs its own retained audit event depends on the system's agreed policy. Keep secrets, tokens, raw sensitive payloads, and unnecessary personal data out of the review package; OWASP identifies data to exclude from logs. A record's identity fields should be sufficient for review without copying customer data.

Run a small fixture that exposes missing records

Use synthetic tenant A and B, a permitted operator, a denied operator, and one target object in each tenant. The example below assumes a schedule-change API that queues a worker. It is hypothetical: it is not a description of any Rainier client's audit system, control selection, or test outcome.

Test actionExpected business stateExpected audit evidence
A operator requests an allowed changeA job exists; schedule not yet changedchange.accepted with A, target and workflow ID
Worker applies the changeA schedule reflects one changechange.completed linked to the accepted workflow
B operator targets A's objectNo A change and no jobchange.denied with the decision and target identifier
Worker receives a duplicate attemptStill one intended schedule changeRetry evidence and one unambiguous final business outcome
Worker fails after acceptanceNo false completionchange.failed or a documented unresolved state with an owner

Create the action list before querying the audit store. Export the authoritative job and state observations separately from the audit records. Match by workflow ID, tenant, action, target, and outcome, then compare counts and unmatched rows. A log with five events for five requests can still be wrong if one denied request is missing and another success was duplicated. Preserve both unmatched sets: expected actions without records and records without an explained action. The latter may be a legitimate retry, an unrelated event in the test window, or an attribution defect; investigate rather than discarding it.

The API retry and idempotency guide explains how to check the business effect under repeated delivery. This worksheet asks a different question: can the receiving team reconstruct the decision and final outcome from retained records? The API access revocation test plan supplies a separate authorization timing fixture if roles can change before the worker runs.

Test the path from producer to reviewer

A producer emitting an event does not prove the reviewer can retrieve it. Follow one synthetic record through creation, transport, indexing, access control, and the agreed retention window. Record the expected delivery delay before testing; a temporarily absent event may be within the contract, but an unexplained gap after that bound is not a pass. Microsoft's monitoring guidance recommends activity IDs across requests and warns against relying on timestamps alone across machines.

Now interrupt the log collector or transport in the authorized test environment. Repeat a permitted action and a denial. Check whether the application still behaves according to its stated failure policy, whether records buffer or fail visibly, whether an alert fires, and whether the events become retrievable after recovery. OWASP specifically recommends testing lost connectivity and logging-system failures. Do not infer a successful audit trail from the application remaining available; the missing records need their own disposition. Also check that a malformed user-controlled field cannot inject a second apparent record.

A reviewable decision should include:

Environment, build, workflow and audit-policy revision:
Required event types and reason for each:
Synthetic actors, tenants, targets and action IDs:
Expected action/outcome rows from the source of truth:
Actual record IDs, destinations and retrieval time:
Expected rows with no record; unexplained records:
Collector-outage behavior, alert and recovery evidence:
Access and retention test scope; excluded sensitive fields:
Pass / fix / not tested, evidence location and retest owner:

A pass means the required action/outcome rows match retrievable records within the agreed bound, attribution is correct, and the tested failure behavior meets the written policy. A fix means a required event is missing, misattributed, falsely reports completion, or cannot be retrieved as promised. Mark an untested collector, retention, or access boundary as not tested, with an owner, rather than calling the whole audit trail complete. This is an engineering acceptance decision, not a compliance certification.

Rainier's published Vennli engagement documents a flight-scheduling portal delivered under subcontract. It does not establish that Vennli used this event contract or passed these tests. For a new work package, put the event contract and reviewer access beside the software subcontractor acceptance checklist, then bring the workflow and evidence boundary to a software subcontracting discussion.

Discuss an auditable software workflow

  • Security
  • Software Delivery

Rainier Software Solutions

Principal-led software engineering for federal and state missions. Secure, scalable, audit-ready.

About Rainier

Building something that has to pass an audit?

Send us the scope and the compliance requirements. You will hear back from an engineer within one business day.