What HIPAA's Audit Controls Rule Actually Demands of Your Logs
Published by CodeNicely, the product studio founded by Meghal Agrawal and Ujjwal Agrawal in 2017For: A seed-to-Series-A digital health founder who just received a BAA request from a hospital system or payer and realized their app logs user actions to a flat application log file that no one has ever queried for a PHI access report
In this guide
- What triggers the obligation
- What the rule actually demands of your architecture
- What this demands of the vendors you use
- How long readiness takes — and what drives the range
- The response windows that drive urgency
- What teams discover far too late
- A pragmatic sequence if you are starting from a flat file
- Frequently Asked Questions
If a hospital just sent you a BAA and your app writes user actions to a flat log file nobody has ever queried, you have a §164.312(b) problem — not a documentation problem, an architecture problem. HIPAA's Audit Controls standard requires that you can produce, on demand, a report of who accessed which PHI record when, filtered by user and date range, in a form an auditor or OCR investigator will accept. A JSON Lines file on an EC2 instance does not meet that bar, even if every access is technically in there somewhere. This post walks through what the rule actually demands of your system, what enterprise security reviewers look for, and the two or three things startup teams almost always discover too late.
What triggers the obligation
The Audit Controls standard at 45 CFR §164.312(b) applies the moment your system creates, receives, maintains, or transmits electronic PHI on behalf of a covered entity. Signing a Business Associate Agreement is the legal trigger; the technical obligations attach to any system in the data path.
Two things founders routinely get wrong here:
- §164.312(b) is a Required standard, not Addressable. There is no implementation specification to scope around and no documented risk analysis that lets you skip it. The audit mechanism itself is the requirement.
- The standard applies to every system that touches PHI, not just your primary database. Your background job queue, your admin tool, your customer support console, the Retool dashboard your ops team uses — all of them are in scope. The read path matters as much as the write path.
The BAA request from the hospital system is the business trigger. The security review that comes with it is where the gap gets exposed. Most enterprise healthcare buyers now ask, in some form: show us a sample audit report for a test patient over the last 90 days. If you cannot produce one in an afternoon, the deal stalls.
What the rule actually demands of your architecture
The text of §164.312(b) is famously thin — "implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information." That brevity is why teams misread it. The enforcement history, not the text, is where the real requirements live.

Based on OCR settlement patterns — including actions against Banner Health, Oklahoma State University, and Lifetime Healthcare that specifically cited audit controls failures — a compliant implementation needs five properties.
1. Every PHI access is logged at the application layer, not just the database
Database-level audit logs (e.g., Postgres pgaudit, RDS audit logs) tell you that a query ran. They do not tell you which end user caused it, because your app connects as a service account. The log that matters is at the point where you resolve a session to a user and a user to a record.
Minimum fields per event:
- Authenticated user ID (not just session ID)
- Action (view, create, update, delete, export, print)
- Resource type and resource ID (e.g.,
patient:48219,encounter:99812) - Timestamp in UTC with millisecond precision
- Source IP and user agent
- Request ID or trace ID that correlates across services
- Outcome (success, denied, error)
Failed access attempts matter as much as successful ones. A user hitting a 403 on another patient's record is a signal; OCR expects you to be capable of noticing it.
2. Logs are queryable by user, by record, and by date range
This is the requirement that kills flat files. If a hospital's privacy officer calls and says "patient Jane Doe believes a staff member looked at her chart on March 14 — show me every access to her record that week," you need to answer in minutes, not days.
In practice that means the audit stream lands in something you can query: a dedicated logging database (Postgres with proper indexes on user_id, resource_id, timestamp), a managed service like AWS CloudWatch Logs Insights with structured fields, Datadog, Splunk, or an OpenSearch/Elastic cluster. The specific tool is not what the rule cares about. The ability to produce "all accesses to resource X by user Y between date A and date B" as a filtered report is.
3. Logs are tamper-evident and effectively immutable
Audit logs that your production engineers can edit are not audit logs. HIPAA expects immutability — once written, entries cannot be modified or deleted during the retention period.
Common patterns that satisfy this in practice:
- Write-once storage with object lock (S3 Object Lock in compliance mode, Azure Immutable Blob)
- Append-only log streams (CloudWatch Logs with a resource policy forbidding
DeleteLogGroup/DeleteLogStream) - Hash-chaining or periodic digest signing so any tampering is detectable
- Separation of duties — the IAM role that writes logs is not the role that can read them, and neither is the role engineers use day-to-day
The question an auditor will ask is simple: can anyone in your organization delete or modify a log entry without leaving evidence? If the answer is yes, you fail the control.
4. Logs are retained for at least six years
HIPAA's general documentation requirement is six years, and audit logs inherit that minimum. Some state laws (New York, Texas) extend further for minors. Plan storage tiering accordingly — hot/searchable for ~90 days, warm for ~1 year, archived for the balance. Glacier Deep Archive or equivalent is fine for the tail, as long as you can retrieve within the response windows below.
5. Logs are actually reviewed
This is where most startups fail even when the collection side is clean. OCR has repeatedly made clear — and unreviewed logs are the single most common audit-controls finding — that the rule requires both recording and examining activity. Settlements with Banner Health and others turned specifically on the failure to review.
Review in practice means:
- Automated alerts for suspicious patterns (bulk exports, after-hours access, access to VIP or employee records, access to records the user has no care relationship with)
- A documented cadence — weekly or monthly — at which someone named reviews a sample of access logs
- Evidence of review: tickets, signed reports, dashboards with timestamps
If you cannot show an auditor the artifact of a review — not just the capability to review — you do not have the control.
What this demands of the vendors you use
You do not have to build all of this from scratch, but every vendor in the PHI data path becomes part of your audit trail obligation. The practical checklist:
- Your cloud provider (AWS, GCP, Azure) will sign a BAA, but only certain services are in scope. Check the current eligible-services list — Lambda, RDS, S3, CloudWatch are typically covered; newer or preview services often are not.
- Your logging / APM vendor must sign a BAA. Datadog, Splunk, New Relic, and Sumo Logic will. Many lower-tier tools will not, which is a hard constraint on vendor choice.
- Your authentication provider (Auth0, Clerk, Cognito) must be in scope and must emit login, logout, and failed-auth events into your audit stream.
- Your analytics and session-replay tools (Mixpanel, FullStory, LogRocket) are the common hidden failure. If they capture PHI in session replays or event properties, they are a business associate and need a BAA — or they need to be excluded from pages that render PHI.
The vendor question for each one is the same: do you sign a BAA, what is in scope, and can you produce audit logs of your own personnel's access to our data?
How long readiness takes — and what drives the range
Getting from "flat file" to "produces a filtered PHI access report on demand" is not a single-sprint project, but it is not a year-long project either for a focused team. The shape of the work:
- Instrumentation — adding structured audit events at every PHI read/write path. Heavily dependent on how many services touch PHI and whether you have a clean data access layer. A monolith with one ORM is a week or two. A dozen microservices with inconsistent patterns is substantially longer.
- Storage and query layer — standing up the queryable, immutable log store with retention policies. Usually the smallest piece if you pick a managed service.
- Review process and alerting — defining what suspicious looks like for your product, building the alerts, assigning the human who reviews. This is where teams underestimate.
- Evidence and documentation — the policies, the runbooks, the sample reports that demonstrate the control works. Often another few weeks.
What moves that range: how many services already have structured logging, whether you have a BAA-signed logging vendor in place, whether you have someone internal who owns security, and whether you are pursuing this alongside SOC 2 Type II (in which case a lot of the evidence work overlaps). Two or three specifics would turn this into a real plan: the number of services in the PHI data path, your current logging stack, and whether you have a compliance deadline tied to a specific customer contract. If you want to scope that for a specific product, our work on HealthPotli and other healthcare builds is a useful reference, and a conversation is the fastest way to a real estimate.
The response windows that drive urgency
The reason "we'll grep the logs if we ever need to" is not a strategy is that the clock during an OCR matter is tight.
- During a desk audit, OCR typically gives 10 business days to produce requested documentation. Failure to produce within that window becomes an additional adverse finding.
- In a complaint investigation, OCR typically gives 30 days to respond to a data request. Missing the deadline signals non-cooperation.
- The average time from complaint receipt to settlement announcement is 57 months — nearly five years. The compliance program and logs you have today are what will be audited when a 2025 incident is resolved in 2030.
And the stakes are not theoretical. OCR issued 22 fines totaling $9.94 million in 2024, with 14 of those resolving Security Rule failures. IBM's Cost of a Data Breach Report puts the average healthcare breach at $7.42 million and the detection-plus-containment window at 279 days — a number that would drop sharply if more organizations actually reviewed their logs.
What teams discover far too late
Three things, in rough order of how often they show up in security reviews:

1. The admin tool is unlogged
Customer support, operations, and engineering tools built on Retool, Forest Admin, or an internal Django admin are the single most common gap. The patient-facing app has clean logging; the internal tool that lets support staff look up any patient by phone number does not. From an OCR perspective there is no distinction — an employee looking at a PHI record is a PHI access event, and it must be logged with the same fidelity.
2. Read-only replicas and analytics pipelines leak out of the logged path
You instrument the primary API. Then a data engineer sets up a read replica for analytics, or pipes PHI into a warehouse for the ML team, and those access paths never get the same treatment. If a data scientist can query a patient's record from a notebook, that access must be in the audit trail.
3. Export and download events are not treated differently
A user viewing one record is one kind of event. A user exporting 50,000 records to CSV is a fundamentally different kind of event and should trigger an alert, not just a log line. The Banner Health and similar settlements turned in part on bulk-access patterns that were logged but not reviewed. Separate event types for bulk operations, and alerts tied to them, are table stakes.
A pragmatic sequence if you are starting from a flat file
- Inventory every service, tool, and vendor that reads or writes PHI. This is usually larger than the founding team expects.
- Define the audit event schema — the fields listed earlier — and commit it to a shared module your services import.
- Instrument the primary API's PHI read/write path first. Ship structured events to a BAA-covered logging destination.
- Instrument the admin tools. Do not skip this.
- Lock down the storage: object lock or equivalent, separate IAM roles, six-year retention policy.
- Build three or four alerts: bulk export, after-hours admin access, repeated failed access to the same record, access to flagged records.
- Write a one-page log review procedure, name an owner, set a cadence, and start producing the artifact.
- Dry-run the audit report: pick a test patient, produce the "all access by all users over the last 90 days" report. If it takes more than an hour, fix the query path before a hospital asks.
None of this is a substitute for a Security Rule risk analysis, a privacy officer, or counsel reviewing your BAA terms. A lawyer and a qualified HIPAA auditor should review your specific situation before you represent the program as compliant to a customer. What the engineering work above buys you is the ability to pass the technical half of a security review without a scramble — and the ability to answer OCR inside the window they actually give you.
Frequently Asked Questions
Does using an encrypted database satisfy HIPAA's audit controls requirement?
No. Encryption at rest addresses a different standard (§164.312(a)(2)(iv), which is Addressable). Audit Controls at §164.312(b) is a separate, Required standard that demands you record and examine activity in systems containing PHI. An encrypted database with no application-layer access logging fails the audit controls standard entirely.
How long do I have to retain HIPAA audit logs?
A minimum of six years, aligned to HIPAA's general documentation retention requirement. Some state laws extend this further, particularly for minors' records. Logs must also be immutable during the retention period — once written, entries cannot be edited or deleted, which usually means write-once storage with object lock or an equivalent control.
Is a flat application log file ever acceptable under HIPAA?
Not in practice. The rule requires that you can examine activity, which enforcement history interprets as producing filtered reports by user, record, and date range. A flat file on a server is theoretically compliant with "recording" but fails on "examining" the moment a hospital privacy officer or OCR investigator asks for a report inside a 10- or 30-day window. Treat queryability as a Required-standard property.
What does it cost to get from zero to HIPAA-compliant audit logging?
The cost model is driven by four things: the number of services in your PHI data path, whether your current logging stack has a BAA in place, whether internal admin tools need to be instrumented too, and whether you are pursuing this alongside SOC 2 Type II. For a single-service startup with a clean data access layer and an existing BAA-covered logging vendor, the work is measured in weeks. For a multi-service product with ad-hoc admin tooling, it is substantially more. Scoping a real number requires looking at your service inventory and your current logging destination — a scoping conversation is the fastest way there.
Who inside the company should own the log review process?
The HIPAA Security Officer by title, but operationally this is usually a security engineer or a compliance lead who runs the weekly or monthly review, triages alerts, and keeps the artifact — a signed report or ticketed review — that demonstrates the control is operating. At seed stage this is often a technical co-founder; by Series A it should be a named role, because "nobody reviewed the logs" is the finding OCR cites most often.
Sources & further reading
- HIPAA Audit Controls 45 CFR 164.312(b) — Petronella Technology Group
- OCR HIPAA Audit Program Guide — One Guy Consulting
- OCR Investigation — How to Respond to HHS (2026) — Patient Protect
- HIPAA Violation Autopsy: What 100 OCR Settlements Actually Reveal — Scrut.io
- New HIPAA Regulations in 2026 — HIPAA Journal
- HIPAA Fines Statistics: Real Penalties & Real Cases in 2026 — FaxSIPit
- HIPAA Technical Safeguards: §164.312 Checklist (2026) — Patient Protect
- HIPAA Audit Logging Requirements — DEV Community (Joe Gellatly)
Get one practical guide a week
Costs, AI tools, partner selection — written for people who make the decision. No spam, unsubscribe anytime.
Thanks — you're on the list. One practical guide a week, nothing else.
That didn't work — please check the email address and try again.
Building something in Healthcare?
CodeNicely partners with founders and tech teams to ship AI-native products that move metrics. Tell us about the problem you're solving.
Talk to our team Book a 30-min call_1751731246795-BygAaJJK.png)