Skip to main content

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.

Audit log page with filters, event list and the Check integrity panel
Audit log page with filters, event list and the Check integrity panel

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.

FieldMeaning
idaudit_ followed by 12 hex characters
occurredAtTime of the event
actionWhat happened (below)
resourceType, resourceId, resourceNameWhat it happened to
runtimeIdThe Site Runtime, if any
actorWho did it
detailExtra facts; detail.requestId is added automatically
ActionDetail
Create, Update, DeleteThe change on a resource
WriteThe value written
LoginRole and authentication source
Login failedReason and whether the account got locked
Logout
Suspend, ResumeRuntime control
ExportCounts 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 has seq, prevHash and hash. 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 genesis or adopt event.
  • When retention deletes old entries, a purge event 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​

  1. Open Audit log.
  2. Click Check integrity.
  3. 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."

FindingMeaning
An entry is missingA gap in the sequence
An entry does not follow the one before itA broken link
An entry was changedIts hash does not match
A group of older entries was changedA day group does not match
The end of the log is missingEntries after the last known head are gone
The start of the log was removedThe anchor is missing
The signature does not matchThe 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 withheld marker is set where tag values may not leave the plant (egress policy).
  • JSONL ends with a chain line (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.

Environment variable name

Some on-screen hints write the name without the MI_ prefix. The variable the Console reads is MI_AUDIT_RETENTION_DAYS.

REST​

Method and pathPurpose
GET /api/v2/audit-events?limit=Latest events (limit 1 to 500, default 100). Returns items, count, retentionDays.
GET /api/v2/audit-events/verifyCheck the chain.
GET /api/v2/audit-events/exportDownload.

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​

SymptomCauseFix
No "Audit log" menuYou lack read_auditUse an auditor or admin account.
"not signed: no master key is set"No MI_MASTER_KEYSet one and restart.
"The start of the log was removed" after an upgradeRetention purged old entriesCompare with the purge event.
Export does not startThe export could not be auditedCheck the database.