See how clinics ship software 3× faster with Epica
Home / Blog / Security
Security

Audit Log Design for Healthcare Software: What HIPAA Actually Requires

A HIPAA-compliant audit log must capture who did what, to which record, when, from where, and with what outcome — not just "turned on default logging." It needs to be tamper-resistant, retained for at least six years, and reviewed on a real cadence, not left to accumulate until an auditor asks for it.

Abstract visualization of a secure, tamper-resistant audit log for healthcare software, rows of verified entries behind a shield motif

Most clinics don't get audit logging wrong because they ignore it — they get it wrong because it's bolted onto an off-the-shelf EHR module after the fact, as a checkbox someone enables, rather than designed in from the start. The result is usually a log that technically exists but can't answer the question an auditor, a patient, or an incident investigator actually asks: who looked at this record, and why.

That gap is exactly the kind of problem a custom software development team that treats compliance as an architecture decision, not a bolt-on, is built to solve. When audit logging is part of the data layer from day one — not a plugin configured after launch — it captures what regulators and incident responders actually need, and it does so without the performance and storage surprises that come from logging everything indiscriminately.

This guide walks through what the HIPAA Security Rule actually requires for audit controls, the specific fields a compliant log entry needs, which events must always be captured, and how to design retention, review, and tamper-resistance into the system before you ship — not after your first security review flags the gap.

What the HIPAA Security Rule Actually Requires for Audit Controls

The HIPAA Security Rule's audit controls standard, detailed in NIST SP 800-66 Rev. 2, requires covered entities and business associates to implement hardware, software, and procedural mechanisms that record and examine activity in systems containing electronic protected health information (ePHI). Notice what that phrasing does and doesn't say: it requires activity to be recorded and examined. A system that logs events nobody reviews satisfies the letter of "record" while quietly failing the intent of the standard.

The rule is also deliberately non-prescriptive about implementation — it doesn't hand you a list of exact fields or a specific retention number for audit logs themselves. That's a double-edged design choice. It gives engineering teams flexibility to build something that fits their actual system, but it also means "we have logging" is not a defense if that logging can't reconstruct who accessed a specific record during an investigation.

Why "Turn On Default Logging" Doesn't Satisfy It

Most frameworks, cloud platforms, and off-the-shelf EHR modules ship with some logging enabled by default — web server access logs, database query logs, application error logs. None of these, on their own, constitute a HIPAA-compliant audit trail, because they're built to debug infrastructure, not to answer "did user X view patient Y's record on this date, and should they have?" Default logs typically miss the patient/record identifier, don't distinguish a legitimate view from an unauthorized one, and are rarely retained, indexed, or protected the way an audit trail needs to be. Treating "logging is on" as equivalent to "we're compliant" is the single most common gap we see when reviewing a clinic's existing system.

What Fields Must a HIPAA Audit Log Capture?

A usable audit log entry answers five questions at once: who, what, when, where, and with what outcome. Miss any one of them and the entry becomes much less useful during an actual investigation — a timestamp with no user ID can't be traced to a person, and a user ID with no outcome can't distinguish a successful access from a blocked attempt.

Example Configuration Checklist — Core Fields for Every Log Entry

  • User ID (who) — the authenticated identity performing the action, never a shared or generic service account where avoidable
  • Action/resource (what) — the specific operation (view, create, modify, export, print, delete) and the resource type it was performed on
  • Timestamp (when) — recorded in UTC with a consistent, synchronized clock source across all services, down to the second
  • Source IP / device (where) — the originating network location and, where relevant, device identifier
  • Outcome — success, failure, or denial, so a blocked attempt is as visible as a completed one
  • Patient/record ID (what data) — the specific record touched, not just "the patients table," so a single query can answer "who accessed this person's chart"
  • Actor's role/permission level at time of access — captured at the moment of the event, since roles change and a later lookup of "current" role can be misleading

Treat this as a minimum, not a ceiling. A system that also logs the authentication method (password, SSO, break-the-glass override) and the originating application or API client makes forensic analysis considerably faster when something does go wrong.

High-Risk Events You Must Always Log

Not every event needs the same scrutiny, but some categories of activity should never be optional or sampled — they get logged every time, without exception, because they're exactly what an investigator or auditor will ask about first.

  • PHI access or view events — any time a human (not an automated process) opens a record containing protected health information
  • Export, print, or download of PHI — data leaving the system's normal viewing interface is a materially different risk than viewing it on-screen
  • Record creation and modification — especially changes to clinical data, diagnoses, or medication records
  • Permission and role changes — granting, revoking, or escalating a user's access level
  • Failed login attempts and account lockouts — these are the earliest signal of credential-stuffing or brute-force activity
  • Break-the-glass / emergency access overrides — any mechanism that lets a user bypass normal access restrictions in an emergency must log the override itself, the justification given, and who it was reviewed by afterward

Designing for Access Control Validation, Not Just Logging

An audit log that exists in isolation from your access control model only tells half the story. The more useful design treats the log as the evidence layer for your RBAC (role-based access control) policy — proof, on demand, that the access rules you've defined are actually what's being enforced in production, not just what's documented in a policy wiki.

In practice, that means every log entry should carry enough context to answer "was this access consistent with this user's role at the time?" without a second system to cross-reference. If a billing clerk's account viewed a clinical note outside their normal workflow, the log entry — role, resource type, outcome — should make that visible on its own, not require someone to manually reconstruct the role assignment from a separate admin table. Teams building this from scratch often find it's a natural checkpoint to bring in outside engineering judgment on how the access layer and the audit layer should be wired together, which is part of why a dedicated software partner gets asked to review this specific boundary during a build.

Change Management and Segregation of Duties in Log Design

A frequently missed requirement isn't about what gets logged — it's about who can read the logs and who can alter them. Segregation of duties means the people with administrative access to modify system configuration should not also be the people with unrestricted, unlogged access to the audit trail itself. If a system administrator can both perform an action and quietly edit the record of having performed it, the log stops being evidence.

In a well-designed system, administrative actions — granting access, changing configuration, modifying another user's permissions — get logged separately and more prominently than routine clinical activity, precisely because admin accounts carry more risk if compromised or misused. Read access to the audit log itself should also be restricted and logged: knowing who reviewed the logs, and when, is part of demonstrating the control actually functions.

Retention, Immutability, and Tamper-Resistance

HIPAA's general documentation retention requirement is six years from the date of creation or the date it was last in effect, whichever is later — a baseline most compliance teams apply to audit logs as general guidance, though this is not a substitute for your own legal review of retention obligations in your specific jurisdiction and business-associate agreements. Building retention in as a database-level policy from the start, rather than a manual archival process someone has to remember, avoids the common failure mode of logs silently rotating out or getting truncated by a storage cleanup job that didn't know they were compliance-critical.

Retention alone isn't enough if the logs can be edited after the fact. Two patterns handle tamper-resistance well in practice: append-only (WORM — write once, read many) storage that physically prevents modification or deletion of existing entries, and cryptographic hash-chaining, where each log entry includes a hash of the previous entry, so any retroactive edit breaks the chain and is immediately detectable. Neither requires exotic infrastructure — most cloud object storage offers an object-lock or WORM mode, and hash-chaining can be implemented at the application layer with a standard cryptographic hash function.

Review Cadence and Exception Handling

A log nobody reviews satisfies the "record" half of the audit controls standard but not the "examine" half. In practice, most compliant programs combine two review mechanisms rather than relying on either alone: automated anomaly detection that flags statistically unusual patterns (a user accessing far more records than their role typically touches, access at unusual hours, a spike in failed logins), and periodic manual spot checks of a sample of entries — commonly monthly for general access logs and immediately for anything flagged as high-risk, like a break-the-glass event.

Automated flags should route to a defined owner, not just accumulate in a dashboard nobody opens. The practical failure mode here isn't missing logs — it's an alerting system that generates flags at a volume no one has time to triage, which trains the team to ignore it. Tuning thresholds so exceptions stay rare and actionable is as much a part of audit log design as the schema itself.

A Practical Build Checklist Before You Ship

  1. Confirm every log entry captures who, what, when, where, outcome, and the specific record touched — not just an application-level event name.
  2. Confirm the high-risk event list (PHI view, export, modification, permission change, failed login, break-the-glass) is logged unconditionally, with no sampling.
  3. Confirm log storage is append-only or hash-chained, and that administrators who can modify the system cannot silently edit the audit trail.
  4. Confirm a retention policy is enforced at the storage layer, not dependent on someone remembering to archive manually, with six years as the working baseline pending your own legal review.
  5. Confirm a review cadence exists — automated anomaly detection plus a scheduled manual sample — with a named owner for triage.
  6. Confirm access to the audit logs themselves is restricted and that reading them is itself logged.

FAQ

How long must HIPAA audit logs be retained?

HIPAA's general documentation retention rule is six years from creation or last effective date, whichever is later. Most compliance programs apply that same baseline to audit logs, though this is general guidance, not legal advice — confirm the specific requirement with counsel, since state law or a business-associate agreement can extend it.

How often should audit logs be reviewed?

There's no single mandated interval, but a workable pattern combines continuous automated anomaly detection with a scheduled manual sample review — commonly monthly — plus immediate review of any flagged high-risk event, such as a break-the-glass access or an unusual export.

What counts as a "high-risk event" that must always be logged?

At minimum: any PHI view, export or print, record creation or modification, permission or role change, failed login attempt, and any emergency access override. These should never be sampled or made optional, regardless of system load or storage cost.

Can audit logs themselves be modified or deleted?

They shouldn't be able to be, by design. Append-only (WORM) storage or cryptographic hash-chaining are the two standard patterns that make unauthorized edits either impossible or immediately detectable, and administrative accounts that can change system configuration should not have unrestricted write access to the log itself.

Who should have access to the audit logs?

Access should be restricted to a small, defined set of roles — typically compliance or security personnel — separate from the general system administrators whose own actions the logs are partly meant to capture. Read access to the logs should itself be logged.

Are audit logs themselves considered ePHI?

Often yes, in practice, because a log entry frequently includes a patient or record identifier alongside the action taken. Treat audit logs with the same access controls, encryption, and handling discipline as the clinical data they describe, rather than assuming they're exempt because they're "metadata."

Does cloud hosting change audit log requirements?

The requirement itself doesn't change, but cloud platforms typically make the implementation easier — most major providers offer object-lock or WORM storage modes and built-in activity logging that can form the infrastructure layer of a compliant audit trail. ONC's HIPAA guidance is a useful starting reference, though your specific business-associate agreement with the cloud provider still needs to cover audit-log handling explicitly.

Need this done right? Epica builds medical software end to end. Talk to us →