Skip to content
HIPAA Compliant AppSecure healthcare engineering

Security & Compliance Resource

HIPAA Audit Logging for Healthcare Applications

HIPAA audit logging has two goals that pull against each other. Logs must record enough to show who accessed which patient's data, and logs must not themselves become an uncontrolled copy of that data.

This page covers the regulatory basis for audit controls, a practical event schema, what to keep out of logs, tamper-evident storage, retention and the review procedures that make logs useful.

Key takeaway

HIPAA requires audit controls, mechanisms that record and examine activity in systems containing ePHI (45 CFR 164.312(b)), and regular review of information system activity such as audit logs and access reports (164.308(a)(1)(ii)(D)). The rule does not prescribe log fields or a log retention period. Applications should log access events with identifiers rather than PHI payloads, protect logs from tampering and set retention through policy and risk analysis.

Last reviewed November 17, 2026

Regulatory basis for audit logging

Audit controls (164.312(b)) is a Required standard with no implementation specifications. It requires hardware, software or procedural mechanisms that record and examine activity in information systems that contain or use ePHI. The design is left to the regulated entity.

Information system activity review (164.308(a)(1)(ii)(D)) is a Required administrative specification: procedures to regularly review records of information system activity, such as audit logs, access reports and security incident tracking reports. Log-in monitoring (164.308(a)(5)(ii)(C)) is Addressable and covers monitoring log-in attempts and reporting discrepancies.

Audit logs are distinct from the Privacy Rule's accounting of disclosures under 164.528, which is a patient right with its own content and six-year lookback. Good audit data can help support it, but the two are not the same thing.

What to log

A useful audit event answers who did what, to which record, when, from where and with what result. Use stable identifiers so events can be correlated without copying clinical content into the log.

  • Authentication events: logins, failures, MFA challenges, lockouts, password and factor changes.
  • PHI access: record views, searches, list queries, exports, downloads and prints.
  • Changes: creation, modification and deletion of clinical and demographic data.
  • Administrative actions: role changes, permission grants, configuration changes, key usage.
  • Emergency access invocations and their justifications.
  • Integration activity: API client calls, bulk exports and interface messages.
FieldExamplePurpose
ActorUser ID, service ID, role, tenantTies activity to a unique identity, supporting 164.312(a)(2)(i).
Actionread, create, update, delete, export, print, shareDistinguishes viewing from changing or exporting data.
ResourceResource type and internal record ID or patient IDShows which record was touched without storing its content.
TimestampUTC timestamp from a synchronized clockEnables reconstruction of sequences across systems.
SourceIP address, device ID, client application IDSupports anomaly detection and investigations.
Outcomesuccess, denied, errorCaptures failed access attempts and authorization denials.
ContextBreak-glass flag, reason code, correlation IDHighlights emergency access and links related events.

What not to log

Application and debug logs are among the most common places PHI leaks. Request bodies, error messages with record content, and verbose ORM logging can copy names, diagnoses and identifiers into systems that lack the same protection as the primary database, and into vendors that have not signed a BAA.

  • No PHI payloads: clinical notes, results, diagnoses, medications or full request and response bodies.
  • No direct identifiers in free text: names, dates of birth, addresses, SSNs, MRNs in messages.
  • No secrets: passwords, access tokens, refresh tokens, API keys or session cookies.
  • No search terms that reveal a condition when typed by a user, unless the store is protected as ePHI.
  • Use allowlists for logged fields rather than blocklists, and redact at the logging library.
If PHI does reach a log, that log store is an ePHI system. It then needs the same access control, encryption and BAA coverage as the primary database.

Tamper-evident storage and integrity

Audit logs are only useful if people under investigation cannot alter them. Separate audit storage from the application database, restrict write access to an append-only path and restrict read access to security and compliance roles.

Common techniques include write-once object storage with retention locks, hash chaining of log batches, signed log digests, and forwarding to a separate account or SIEM controlled by a different team. Time synchronization across systems matters for investigations.

Retention and review

HIPAA's six-year retention requirement in 164.316(b)(2)(i) applies to required documentation, such as policies, procedures and records of required actions, activities and assessments. It runs from the date of creation or the date last in effect, whichever is later. The rule does not set a specific retention period for raw audit logs.

Audit log retention should be set by policy and the risk analysis, considering investigation needs, state law, contractual commitments, litigation holds and the accounting-of-disclosures lookback. Many organizations choose to retain audit logs, or summaries of them, for six years for consistency. Store review records, such as reports, findings and follow-ups, as documentation subject to the six-year rule.

  1. 1

    Define review cadence

    Set how often logs and access reports are reviewed, by whom, and what triggers ad hoc review.

  2. 2

    Automate detection

    Alert on patterns such as access to a VIP or employee record, mass record views, after-hours exports and repeated denials.

  3. 3

    Review break-glass events

    Route every emergency access event to a reviewer queue.

  4. 4

    Document results

    Record each review, its findings and follow-up actions as retained documentation.

  5. 5

    Feed risk management

    Use review findings to update the risk analysis and controls.

Audit logging architecture

A practical architecture separates two streams. Audit events, which record ePHI access and administrative actions, go to a protected, append-only store with long retention. Operational logs, used for debugging and performance, stay PHI-free and have shorter retention.

Emitting audit events from a shared middleware or data access layer, rather than from individual handlers, makes coverage consistent. Correlation IDs connect an audit event to the operational traces of the same request without copying data between the streams.

  1. 1

    Define the schema

    Agree on a versioned audit event schema and required fields.

  2. 2

    Emit centrally

    Generate events in middleware or the data access layer so every path is covered.

  3. 3

    Transport reliably

    Use a durable queue so audit events are not lost when a service fails.

  4. 4

    Store immutably

    Write to an append-only store in a separate account with restricted access.

  5. 5

    Index for investigation

    Make events searchable by user, patient, time range and action.

How we help

We design audit event schemas, build PHI-safe logging pipelines with redaction, configure tamper-evident storage and set up alerting that supports your review procedures. Retention decisions, review staffing and sanctions remain with your organization.

This page is general information about software engineering for healthcare, not legal advice. HIPAA compliance depends on your organization's risk analysis, policies, workforce practices, vendor agreements and how PHI is actually handled. No software, hosting provider or development partner can make an organization compliant on its own, and there is no official HIPAA certification for applications.

Frequently Asked Questions

Does HIPAA require audit logs?

Yes. Audit controls under 164.312(b) are Required, and 164.308(a)(1)(ii)(D) requires regular review of information system activity such as audit logs and access reports. The rule does not prescribe specific fields or tools.

How long must HIPAA audit logs be retained?

HIPAA's six-year retention rule in 164.316(b)(2) applies to required documentation. It does not set a specific period for raw audit logs, so retention should be set by policy and risk analysis; many organizations choose six years for consistency.

Can logs contain PHI?

They can, but then the log store must be protected as an ePHI system with access control, encryption and BAA coverage for any vendor. The better practice is to log identifiers rather than PHI payloads.

What should a HIPAA audit log entry include?

Typically the actor, action, resource identifier, timestamp, source and outcome, plus context such as a break-glass flag. Together these show who accessed which record, when and how.

Do read events need to be logged?

Logging reads is widely regarded as essential, because inappropriate viewing is a common privacy incident. Without read events, it is difficult to investigate snooping or support access reviews.

Can we send logs to a third-party logging service?

Yes, if the service either receives no ePHI or signs a BAA and is configured appropriately. Error tracking and log analytics tools frequently capture request data by default, so verify their configuration.

How often should audit logs be reviewed?

HIPAA requires regular review but does not set a frequency. Organizations combine automated alerting for high-risk events with scheduled reviews whose cadence is set by policy.

Plan your HIPAA-compliant app with engineers who start from the data flow.

Tell us what you are building. We will respond with questions about scope, integrations and PHI handling, then a structured estimate. Please do not include patient information.