Blog

    Log Management for HIPAA: Centralized Logging Without Exposing PHI

    By GauravAugust 21, 20269 mins read
    On this page

    Log management under HIPAA means centralized logging that operators can search without exposing PHI. A correlation id, an opaque user id, a time and a result are enough to find an event, while the audit copy HIPAA requires sits in a tighter store with its own readers. Names, MRNs and results stay out of the ops index.

    Written for digital health founders and hospital CTOs running platforms that handle PHI, it covers the fields, hidden identifiers, redaction, incident tracing, common mistakes and testing.

    How do you centralize logs under HIPAA without exposing PHI?

    You centralize logs under HIPAA without exposing PHI by writing only a correlation id, an opaque user id, a time and a result to the ops log, and keeping the audit copy in a separate store. Agnotic Technologies never indexes names, MRNs or clinical values in ops search, and tests every field against minimum necessary.

    Operators cannot find events without leaking PHI?

    We log correlation id, unique user id, time, and result in ops. The audit copy is a tighter store.

    45 CFR 164.312(b) requires mechanisms that record and examine activity in systems that contain or use electronic protected health information.

    45 CFR 164.502(b) requires a covered entity to make reasonable efforts to limit protected health information to the minimum necessary to accomplish the intended purpose.

    • Ops line: correlation id, unique user id, service, time, success or error class.
    • Audit copy: the access HIPAA asked you to record, in a store with its own access list.
    • Forbidden in ops: name, MRN, account number, result value, free-text note.
    • Join: only in the audit store, by people who are allowed to see the chart.

    Interface engines such as Mirth Connect need the same rule inside each channel log. The pipeline described here is the shared platform that service and channel logs feed.

    What happens when a line already contains PHI?

    That line is a defect. Agnotic redacts it from ops, records the defect, and fixes the emitter. The audit copy is not a dumping ground for fields ops should never have seen.

    • Redact ops. Do not 'fix' by copying the PHI into audit and leaving ops unchanged.
    • Fix the emitter so the next line cannot contain the field.
    • Name the owner of that emitter on the defect row.

    Which fields belong in an ops log line?

    An ops log line needs enough fields to place an event in time, in a service and in a request, and no field that describes the patient. Agnotic defines that set once in a shared logging library so each service cannot invent its own.

    • Timestamp in UTC, service name, environment and build version.
    • Correlation id, created at the edge and passed through every hop.
    • Unique user id: the opaque id from the identity provider, never an email address or display name.
    • Action and resource type, such as a read on DiagnosticReport, without the resource id.
    • Outcome, error class and latency.

    Anything outside that set is refused by the library rather than written. An allow-list of fields fails safe; a pattern that hunts for names and MRNs after the fact does not.

    Which identifiers slip into logs without anyone noticing?

    The identifiers that slip in are the ones nobody typed on purpose: URLs, IP addresses, device serials and dates inside query strings. The HIPAA de-identification list works as a checklist here, even though de-identifying the logs is not the goal.

    45 CFR 164.514(b)(2)(i) lists identifiers removed under the safe harbor de-identification method, including names, dates directly related to an individual, medical record numbers, account numbers, device identifiers, URLs and IP addresses.

    • Request URLs: a patient search by family name and birthdate puts both values in the proxy access log.
    • Client IP addresses from a patient-facing app, recorded by every proxy by default.
    • Device identifiers from remote monitoring hardware, echoed in connection errors.
    • Exception messages that repeat the invalid input, including the value that failed validation.

    How is the audit copy different from the ops stream?

    The audit copy records who accessed which record and when, for a small group of reviewers. The ops stream records how the system behaved, for every engineer on call. They differ in readers, contents, protection and lifetime.

    Central logging without PHI in the line: services emit a correlation id, action, resource type, outcome and an opaque user id to a shared logging library that rejects unregistered fields and drops query strings, then splits each event into an ops index searched by on-call engineers and a separate append-only audit store that holds the patient reference for named reviewers, with a collector filter as a second net
    • Readers: ops serves on-call engineers. Audit serves privacy, compliance and named reviewers.
    • Contents: ops has the correlation id and resource type. Audit adds the patient reference and the record touched.
    • Protection: ops indices are rotated and re-indexed as operations need. Audit is append-only, with changes detectable.
    • Lifetime: ops follows operational need. Audit follows the retention your policy sets for access records.

    The audit copy also has to be protected from alteration, which is why it does not sit in a cluster where operators delete old indices to free disk space.

    Where should redaction happen in the pipeline?

    Redaction should happen at the emitter first, inside the service that writes the line, with the collector as a second net. Redacting only at the index means PHI has already crossed the network and sat in buffers.

    • Emitter: the shared library accepts only registered fields and drops query strings before the line is written.
    • Collector: a filter masks known risky patterns and counts what it masked, per service.
    • Index: field mappings refuse unknown fields instead of creating them on the fly.

    A non-zero count at the collector is a defect against the emitter. The collector catching the value does not close that defect.

    How do operators trace an incident without seeing the chart?

    Operators trace an incident by following the correlation id across services in the ops index, which shows where the request failed without showing whose data it carried. Patient-level detail is a separate, recorded step.

    • Step 1, the alert carries the correlation id and error class, not the payload.
    • Step 2, the on-call engineer searches that id and sees each hop, its latency and its outcome.
    • Step 3, if the fix depends on which record was involved, a person with audit access looks it up and records why.
    • Step 4, the fix is verified with the correlation id of a fresh test request.

    Most incidents end at step 2. When one does not, the escalation itself becomes part of the access record.

    How should user ids appear when patients are the users?

    When patients sign in to a portal or app, their account id points straight at a person, so the ops line should carry a platform-issued pseudonymous id instead. The mapping from that id to the account lives in the audit store.

    • Staff users: the identity provider's opaque subject id is usually enough.
    • Patient users: a pseudonymous id per environment, stable enough to follow one session across services.
    • Service accounts: their own named ids, so automated access is never mistaken for a person.

    An unsalted hash of an email address is not a pseudonym. Anyone holding a list of emails can hash them and match the results.

    What are the common mistakes that put PHI back into central logs?

    PHI comes back through defaults and tooling more often than through application code. Each item below has a setting or a review that stops it.

    • Debug level left on in production after an incident.
    • ORM or SQL logging that prints bound parameter values.
    • Web server access logs that record full query strings.
    • Tracing agents that capture request and response bodies by default.
    • Alert integrations that paste the whole log line into a chat channel.
    • A third-party library that prints its payload to stdout on error, collected by the container log shipper.

    How do you test that the ops index stays clean?

    You test it by running real workflows with synthetic patients whose values are unique markers, then searching the ops index for those markers. Any hit is a leak with a known source.

    • Seed synthetic patients with distinctive names, MRNs and result values in the test environment.
    • Run the main workflows end to end, including error paths and retries.
    • Search the ops index and collector buffers for every marker.
    • Add a unit test to the logging library that refuses any unregistered field.

    Run the marker search again after any release that touches logging, tracing or a proxy. Those are the changes that bring leaks back.

    A worked example: a failed lab result upload

    A worked example: a lab interface posts a result to the platform and gets a validation error. The on-call engineer receives an alert with a correlation id and the error class invalid_unit.

    Searching that id shows the request passed the API edge, reached the results service and failed validation. The ops line names DiagnosticReport and the error class, not the patient or the value.

    The fix is a unit mapping in the interface, so nobody needs to open the chart. The audit store has already recorded which record the failed write targeted, for anyone with a reason to look.

    Who owns the log pipeline and the audit store?

    Different owners keep the two stores honest, because the people who debug systems should not also control the record of who viewed patients. Agnotic sets this split before the first service ships logs.

    • Platform team: the logging library, collector filters and ops index.
    • Service teams: their emitters, and each defect raised against them.
    • Privacy or compliance officer: the audit store access list and its review schedule.
    • Security: integrity controls on the audit store and alerts on access to it.

    How does Agnotic split the two stores?

    Agnotic builds the shared logging library, the collector filters, the separate append-only audit store and the marker-search tests, and agrees the ownership split with the client before the first service ships logs.

    Thin ops, separate audit, minimum necessary

    Search the correlation id. Open the chart only in the audit store, with an allowed user.

    Related reading on Agnotic

    PHI out of the channel log, HIPAA as the framework, and healthcare IT compliance.

    Sources

    Frequently Asked Questions

    Not in ops. Minimum necessary still asks whether ops needs the MRN to find the event. A correlation id is enough.

    Talk to an engineer about your project

    Show us a log line you search today. We will keep correlation id and unique user id in ops, move the audit copy aside, and drop PHI from the index.