Audit log
Read the engine's audit log, ask it questions, check who viewed a patient's PHI, review flags, and run the HIPAA access report, legal holds and the daily anchor.
On this page
The audit log records every change, sign-in, PHI view and Agent action on the engine. Open it from Audit log in the sidebar. The subtitle says how long records are kept and, when log export is on, where they are streamed: "Kept 6 years, streamed to Splunk."
The badge in the header shows the state of the hash chain, for example Chain intact · verified 14:30. Click it to walk the chain again.
The page has five tabs: Activity, PHI access, People, Flags and Reports & retention. A link can open one directly with ?tab=phi, ?tab=people, ?tab=flags or ?tab=reports.
Ask the audit log
The bar at the top takes a plain-English question, such as "What changed before pharmacy-east went down?" or "Everything the Agent did today". Press Enter or click Ask.
The answer card is marked Agent · read-only search. The Agent searches the log and links the events it relied on as chips (14:31 vpn_tunnel.psk_rolled_back). Click a chip to open that event in Activity. Clear removes the answer.
- Read-only. The Agent gets masked events as data and has no tools. It cannot change anything.
- No PHI in answers. An answer that looks like it holds a patient identifier is dropped, and the plain search answer is shown instead.
- Questions about a patient. Looking a patient up by MRN needs the Operator role. The MRN is turned into a keyed hash and is never stored.
- Audited. Each question is recorded as
audit.askedwith its length, never its text. - AI off. With AI features off, the bar shows a note in its place. Every other tab still works.
The suggestion chips are examples. The MRN in "Who viewed MRN 551207 this month?" is made up: the chip searches this month's PHI views and looks no patient up.
Activity
Activity lists events newest first, grouped by day ("Today · Oct 29"). Each row shows the time, the person's initials, a plain-language sentence and the stored event type, with a category pill. A row the flag rules picked out also shows FLAG.
Several views of one patient's messages by one person within a few minutes are folded into one row, for example "Viewed 38 messages for one patient in 2 minutes". Its detail lists every event behind it.
Click a row to open its detail:

- Who, When, Action, From, Context and Event id.
- Before and after values for a change.
- Agent action for a change the Agent proposed: the conversation it came from and who approved it.
- The hash chain around the event: the previous event, this one and the next.
- A link to what the event changed: the tunnel, message, workflow, queue or connection.
Activity categories
The chips above the list filter it, and each shows a count.
| Category | What it holds |
|---|---|
| All | Every event. |
| Changes | Changes to workflows, connections, tunnels, queues and settings, and any event that fits no other category. |
| PHI access | Every view of PHI: reveals, message views and message exports. |
| Sign-ins | Sign-ins, sign-outs, MFA and sessions. |
| Agent | What the Agent read, proposed and did after an approval. |
| Access | Who may do what: roles, members, operators and MedHook support access. |
| System | What the engine did on its own, such as health checks and schedules. |
Search, Export and Stream logs sit above the list. Export and Stream logs are for admins.
PHI access
PHI access answers "who viewed this patient's PHI?". The four figures at the top count today's PHI views, the people who made them, the views that were flagged, and views from outside the workspace.
Type a patient's MRN to list every view of that patient in the last 90 days: when, who, what they saw, the reason and where from. Flagged rows are highlighted. When nobody viewed the patient, the list reads "No PHI views for this MRN in 90 days".
- What they saw reads, for example, "fields and raw" for a reveal, "fields" for a plain message view, "masked fields only" for the Agent, or "38 messages in Needs action" for a replay.
- Generate PDF for this patient builds the per-patient access report. It shows masked identifiers only and is audited as
audit.phi_access_report. - Searching is audited. Each MRN search is recorded as
audit.phi_access_searched. The MRN itself is stored only as a keyed hash.
Messages' reveals and views show here too. Each Show PHI on Messages writes phi.revealed with the reason and the patient's keyed hash, and each message opened writes message.viewed, as does a signed-in person's raw read of a message through the engine API. A patient search is audited as message.searched, with the MRN only as a keyed hash, and an export as message.export; the export has no patient column. See PHI on Messages.
The workflow builder's PHI views show here too. Each Show PHI in the builder, on the Data Map and sample, a test run, the live proof, the Errors tab, a field's recent values or a test case pinned from a real message, writes phi.revealed with the reason and the patient's keyed hash. Running a recent message as a test input, and the Data tab's last real input at a step, write message.viewed. A signed-in person who reads an execution or a workflow's sample raw through the engine API also writes message.viewed, marked raw. An API client's read doesn't. See PHI in the builder.
Searching by MRN needs the Operator role. A viewer sees the figures and the latest views, but can't search for a patient.
People
People lists everyone who acted in the workspace, newest first, with their role, when they were last seen and how many open flags they have. The Agent is listed too, as "Service · acts with approvals".
Select someone to see:
- Last seen, PHI views · 30 d, Changes · 30 d and Open flags. A person whose only PHI activity was exports shows "4,100 exported"; the Agent shows "masked only", because it opens no PHI views. That is not a promise that no PHI reaches the AI provider: structured HL7 and FHIR identifiers are masked before a prompt is sent, free text is masked on a best-effort basis (a name with no cue word such as "patient" or "Mr." can get through), and prompts go to the AI provider configured for the engine (Anthropic or Vertex AI). Use synthetic data until a BAA covers that provider.
- A note for MedHook support access. A support user's access is time-boxed: the note names who granted it and when it expires.
- Their six most recent events.
Flags
The engine checks the log against five rules and raises a flag when one matches:
| Rule | Severity |
|---|---|
| More than 20 PHI views of one patient within 5 minutes. | High |
| A sign-in from an IP not seen in 90 days, outside 06:00 to 22:00. Someone's first sign-in ever is not flagged. | High |
| An export of more than 1,000 messages by one person in a day. | Medium |
Password sign-in paused after repeated wrong sign-in codes (auth.signin_locked). | High |
Repeated wrong passwords for one account from many addresses (auth.password_spray_suspected). | High |
Working hours (06:00 to 22:00) are judged in the workspace's time zone (Settings › Overview). A workspace with no zone set uses the engine's own zone (TZ); AUDIT_FLAG_TIMEZONE pins one zone for every workspace.
The new-IP rule is only as good as the client IPs the engine records: set CLIENT_IP_SOURCE for your load balancer (Security).
The Flags tab shows how many flags are open. Each flag shows its rule, an Agent · context card that explains what the person was doing around it, and the related events. With AI features off, the context is written from the events instead.
An admin acts on a flag in one of three ways:
- Mark reviewed, with an optional note for the record: what you checked and why it's fine (or not).
- Assign it to someone. "They'll see it in their Flags tab": their own flags come first.
- Open an incident. This revokes the person's sessions pending confirmation and emails the privacy officer. The email names the incident and the flag, never a patient.
Reviewed flags and incidents are dimmed in the list. Every action is audited.
Reports and retention
HIPAA access report
The HIPAA access report lists who viewed whose PHI, for the privacy officer. It shows masked identifiers only.
On the 1st of each month the engine emails last month's report as a PDF to the workspace's privacy officer. The row shows when it was last sent and when it is next due ("last sent Oct 1 · next Nov 1"). Send now sends it at once; an admin can send it up to three times an hour. Set the privacy officer's address in Settings › General. With no address set, nothing is sent. With email off on the engine, download the PDF instead.
The email itself holds no PHI: the month, the counts and a link back to the report. Each send is audited as audit.report.sent.
Per-patient report on request opens the PHI access tab, where you generate one patient's report.
Retention
| Record | Kept |
|---|---|
| Audit events | 6 years |
| Message bodies | EXECUTION_RETENTION_DAYS, 2190 days (six years) by default. Each workflow can set its own, 7 to 3650 days, and keep its failed executions longer. See Retention. |
| PHI view records | 6 years, even after the message is deleted |
The periods come from the engine's settings. See Audit log and Retention.
Legal hold
A legal hold keeps matching records past retention until it is released. An admin adds one by patient, workflow, user or date range.
- Click Add on "Add a hold". The engine creates a draft named "New hold".
- Click Edit, choose what it covers and give it a name. A draft keeps nothing.
- Click Start hold. From now on, the purges skip what it covers.
An active hold can't be edited, so what it keeps can't quietly shrink. Release asks you to confirm, because the records can be purged after that. A hold on a patient shows the MRN masked.
A patient hold keeps that patient's audit and PHI view records, not their runs or message bodies. Runs are not held: add a workflow or date-range hold to keep them.
Integrity
Each event stores the hash of the one before it. Editing or deleting an event breaks the chain, so it shows. Verify now walks the chain and updates the badge.
Every walk reads the whole chain, from the oldest event kept, and checks every daily anchor in it. On a large audit log that takes longer than a page request may, so the walk carries on in the background: the badge reads Verifying… 42% until it ends, then shows the result. Leaving the page doesn't stop the walk, and if an engine restarts mid-walk another picks it up where it stopped. One walk runs at a time: a second click, from you or anyone else, follows the walk already running.
From the API, GET /api/audit-log/verify answers the result when the walk ends within a few seconds. Otherwise it answers 202 with a jobId and the walk's progress; poll GET /api/audit-log/verify?jobId=<jobId> until it answers 200 (intact) or 409 (broken). The stored result (?cached=1) changes only when a walk ends.
Daily anchor
At 00:00 UTC the engine publishes the day's anchor, the hash of the newest event, to an external timestamping service (RFC 3161). Only the hash leaves the engine. With the anchor held outside MedHook, an edit made after that time would show even if the whole chain were rewritten.
Set the timestamping service in Settings › Notifications. Until one is set, the row reads "not published yet · set a timestamping service" and the anchor is kept in the engine only.
Who can do what
| Action | Role |
|---|---|
| Read the log, ask a question without an MRN, Verify now | Viewer |
| Search PHI access by MRN, generate a patient's PDF | Operator |
| Review, assign and open incidents on flags | Admin |
| Add, edit and release legal holds | Admin |
| Download or send the HIPAA access report | Admin |
| Export the log, Stream logs | Admin |
A button you can't use is disabled and says which role it needs. See Roles.