FHIR AuditEvent is the resource that records security-relevant activity on a FHIR server: who accessed what, when, from where, with which outcome and under which authority. It is the FHIR way to build the access trail that HIPAA audit controls, info-blocking reviews and partner security assessments all examine.

Many teams discover the requirements in reverse order: an external review finds that the trail cannot answer basic questions, and the fixes turn out to be architectural. That was the state of the platform before we built its FHIR interoperability layer. PHI appeared in the logs of three subsystems, and reads were not tied to the consent that allowed them. The rebuilt audit layer passed the next external review with no remediation, because the trail was designed as a system of its own.

What AuditEvent records

An AuditEvent instance holds a security event as structured data: the action type and subtype (read, create, update, query, export), the outcome, the time, the agents involved (user, app, system, network address), the source that reported it and the entities touched, usually references to the resources read or written.

Because actor, action, entity and time are fields, "who read this record" becomes a query. Application logs can answer the same question only after a long search and with some luck. The structure also lets partners and review tools consume your trail without learning a private log format.

Three rules keep the resource useful. Record reads as well as writes, including searches that returned nothing, since access reviews care mostly about reads. Record failures, because a denied request is often the most telling security event. And record system actors: batch jobs and background services touch more PHI than any person, so a trail limited to interactive users is incomplete.

AuditEvent vs Provenance

FHIR has two resources with similar names. AuditEvent records access, meaning who touched a resource. Provenance records origin, meaning where a resource came from and what changed it. An Observation imported from a partner EHR should carry a Provenance saying so, and each later read of that Observation should produce an AuditEvent.

Different reviewers use them. A data-quality investigation follows Provenance to learn why a value looks the way it does; a security review follows AuditEvents to learn who saw it. A complete platform emits both. If the work has to be sequenced, start with AuditEvent, since review findings nearly always concern access.

FHIR read passing scope checks and writing an AuditEvent, linked to its Consent, into a hash-linked WORM audit chain
Each read and write produces an AuditEvent that references its authorizing Consent; hash links make any edit visible.

A complete trail ties every access to the authority that allowed it. On a FHIR server that authority can be a Consent resource, and the AuditEvent for a read can reference the Consent under which it was permitted.

With that link, "show every access to this patient's record and the basis for each" is a join. It also changes code upstream: if writing an audit event requires naming the consent, the authorization logic must actually find one, and requests that ran on assumption become visible. On our platform the external review checked exactly this property, every read and write scoped to its Consent.

Keeping PHI out of the trail

An audit trail must prove access to sensitive data without holding a copy of it. A trail that quotes names, diagnoses or document text is a PHI store in its own right, with retention, access control and breach exposure to match, and it is usually readable by more internal staff than the data it describes.

The answer is to store references. Entities point to resources by opaque ID, a generated request ID ties related events together, and the actor is a user or client identifier. Enforce this in code: in our build a redaction filter sits in the log enricher, so PHI cannot reach a log line even when a developer forgets a rule.

The same applies outside the FHIR server. Our HIPAA audited file proxy writes one record per read, expiry and token use, and our automated reporting system records who generated which report from which source query, in both cases without copying patient content into the log.

Tamper evidence and replay

A trail that can be edited without a trace proves little. Hash-linking fixes that cheaply: each record carries the hash of the one before it, so any change or deletion breaks the chain, and the chain lives in write-once (WORM) storage. To alter one event, an attacker would have to rewrite every later record in storage built to refuse rewrites.

The chain also has to be exercised. We replay it in CI on every release, so each build proves the history still verifies end to end. HIPAA controls that are never tested decay like any other untested code.

The decisions are few: structured events, reads and writes both recorded, consent links, references in place of content, hash-linked storage and replay in CI. Taken early, each is a small design choice; taken during a review, each becomes a migration. The standards around this trail are covered in TEFCA vs FHIR and USCDI and FHIR.