Audit trail
The Audit log answers "who changed what in the Console": configuration changes, sign-ins and tag writes. It is tamper-evident: each entry is chained to the one before it, so a removed or changed entry can be detected.

The page is Audit log (title "Audit Log"; subtitle "Who changed what in Console — config, auth, and tag writes."). It is visible only with the read_audit permission (the auditor and admin roles).
What is recorded
The list shows the latest 200 events. Use the filters Action, Resource and Site, or the search box ("Search name, actor, id..."). Columns: When, Action, Resource, Name, Site, Actor, Detail.
| Field | Meaning |
|---|---|
id | audit_ followed by 12 hex characters |
occurredAt | Time of the event |
action | What happened (below) |
resourceType, resourceId, resourceName | What it happened to |
runtimeId | The Site Runtime, if any |
actor | Who did it |
detail | Extra facts; detail.requestId is added automatically |
| Action | Detail |
|---|---|
| Create, Update, Delete | The change on a resource |
| Write | The value written |
| Login | Role and authentication source |
| Login failed | Reason and whether the account got locked |
| Logout | |
| Suspend, Resume | Runtime control |
| Export | Counts of devices, applications, subscriptions, streams, sinks, rules and certificates |
Resource labels: Device, Destination (application), Route (subscription), Stream, Sink, Rule, Certificate, Tag, Group, User, Auth, Config, Settings, "Alert webhook".
Related records live elsewhere:
- Proposals and decisions: Approvals → Audit trail (propose, approve, reject, execute, fail). See Approvals and safe write.
- Calls from AI assistants and API keys: the MCP audit. See MCP server.
How the hash chain works
- Format
mii-audit-v1. Each entry hasseq,prevHashandhash. The hash is SHA-256 over a fixed (canonical) JSON form of the entry and its position. - The first link's previous hash is 64 zeros.
- Entries written before the chain existed are covered as groups (one per UTC day) by a
genesisoradoptevent. - When retention deletes old entries, a
purgeevent records an anchor, so the deletion itself is visible. - If a master key is set, the chain is signed ("sealed") with it. Without a master key the chain is not signed.
Check integrity
- Open Audit log.
- Click Check integrity.
- Read the result: "The audit log is intact." or "The audit log has been changed or is incomplete."
The panel also shows how many entries were checked, "older entries checked as groups", entries "not protected yet", entries removed by retention, and the signature state ("signed with the master key" or "not signed: no master key is set"). It shows "Newest entry N" and its hash.
Keep that hash outside the Console (for example in your ticket system). Later you can prove that nothing at or before that entry was removed.
The browser remembers the last head (mii.audit.head.v1 in local storage) and sends it with the next check. You then see "Continues from the last check in this browser." or "The entry seen at the last check in this browser is gone. The log may have been replaced or cut."
| Finding | Meaning |
|---|---|
| An entry is missing | A gap in the sequence |
| An entry does not follow the one before it | A broken link |
| An entry was changed | Its hash does not match |
| A group of older entries was changed | A day group does not match |
| The end of the log is missing | Entries after the last known head are gone |
| The start of the log was removed | The anchor is missing |
| The signature does not match | The seal is wrong |
Only one verification runs at a time; otherwise you get 429 "a verification is already running". API: GET /api/v2/audit-events/verify (optional expectedSeq and expectedHash, which must be given together).
Export
Use the date fields From and Up to and including, then Download CSV or Download JSONL. The file is named mii-audit-<UTC time>.csv or .jsonl.
- Exports include
seq, hashes and group markers, so you can verify the file offline. - A
withheldmarker is set where tag values may not leave the plant (egress policy). - JSONL ends with a
chainline (chainId,headSeq,headHash,anchorSeq,anchorHash). - CSV cells are protected against spreadsheet formula injection.
- The export itself is audited first (action
export). If it cannot be recorded, it does not happen.
API: GET /api/v2/audit-events/export?format=jsonl|csv&from=&to=.
Retention
Old entries are deleted once a day. Set the age with MI_AUDIT_RETENTION_DAYS on the Console: default 365, allowed range 7 to 3650 days. The MCP audit has its own MI_MCP_AUDIT_RETENTION_DAYS (default 365, 7 to 3650). The API reports the active value as retentionDays.
Some on-screen hints write the name without the MI_ prefix. The variable the Console reads is MI_AUDIT_RETENTION_DAYS.
REST
| Method and path | Purpose |
|---|---|
GET /api/v2/audit-events?limit= | Latest events (limit 1 to 500, default 100). Returns items, count, retentionDays. |
GET /api/v2/audit-events/verify | Check the chain. |
GET /api/v2/audit-events/export | Download. |
All need read_audit.
Limits and good practice
- Keep the head hash outside the Console after important periods and after each upgrade.
- Set a master key (
MI_MASTER_KEY), so the chain is signed. See Security model. - Export to your own archive before retention removes old entries, if you must keep them longer.
- The log records the value of a write, not the device's later state. Use the approval audit and safe write read-back for that.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| No "Audit log" menu | You lack read_audit | Use an auditor or admin account. |
| "not signed: no master key is set" | No MI_MASTER_KEY | Set one and restart. |
| "The start of the log was removed" after an upgrade | Retention purged old entries | Compare with the purge event. |
| Export does not start | The export could not be audited | Check the database. |