Get started with Audit & Reports
Read everything that happened for one user and for one agent on the realm's audit trail, with every call.
AvailableAPI
In this walkthrough you read the audit trail of the user maya in the realm foobar: her sign-ins, the tokens issued
to her apps, and what agents did in her name. Then you read the trail of the agent invoice-agent: every token it was
issued or refused, every exchange it made, and every change to its record.
Before you begin
Section titled “Before you begin”- You hold
READon the realmfoobar:RealmOwnerincludes it, andRealmViewergives it with no right to change anything. To give an auditor that access, see Give an auditor read-only access. - You are signed in with your session in
$CVYUH_SESSION: Call the API shows how. Everything here is done in the API. - The trail names each principal by its id, the
idthe realm gave it when it was made, not the name you address it by. The first step of each part looks it up.
Read what happened
Section titled “Read what happened”-
Look up the user’s id. Read
mayaand note herid:Terminal window curl https://foobar.cvyuh.com/api/v0/am/objects/v1/user/maya \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"{"id": "<maya's id>","objectId": "maya","typeName": "user","rev": 4,"attributes": { "…": "…" }} -
Read her trail. Name her with
person:Terminal window curl "https://foobar.cvyuh.com/api/v0/am/audit/v1/trail?person=<maya's id>&pageSize=20" \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"{"principal": "<maya's id>","kind": "person","events": {"data": [{ "eventType": "TOKEN_ISSUED", "result": "SUCCESSFUL", "…": "…" },{ "eventType": "LOGIN", "result": "SUCCESSFUL", "…": "…" }],"page": 1,"pageSize": 20,"totalCount": 37,"totalPages": 2},"changes": { "data": [], "…": "…" }}eventsare newest first byeventTime. Each says what happened (eventType), when, how it went (result), who acted (principals), itscontextand, for a sign-in, each step inentries. A fullLOGINrecord looks like this:{"id": "<record id>","eventType": "LOGIN","eventTime": "<event time>","result": "SUCCESSFUL","userId": "<maya's id>","principals": ["maya"],"context": {"authLevel": 0, "maxSessionSecs": 7200, "maxIdleSecs": 1800, "name": "maya"},"entries": [{ "position": 0, "moduleId": "nativeStore", "result": "succeeded","info": { "authControlFlag": "REQUIRED", "authLevel": 0,"ipAddress": "203.0.113.24", "moduleClass": "NativeStore" } }],"trackingIds": {"sessionName": "<session name>", "sid": "<sign-in id>","authId": "<sign-in attempt id>", "ctxId": "<session context id>"},"traceId": "<trace id>","spanId": "<span id>","parentSpanId": null,"transactionId": "<transaction id>","component": "authentication","realm": "<your realm>"}Its
trackingIds.sidis the same as thesidon everyTOKEN_ISSUEDrecord that sign-in led to: see Record fields and examples. -
Look up the agent’s id. Read
invoice-agentand note itsid:Terminal window curl https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/invoice-agent \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" -
Read the agent’s trail. Name it with
agent:Terminal window curl "https://foobar.cvyuh.com/api/v0/am/audit/v1/trail?agent=<invoice-agent's id>" \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"The answer has the same shape, with
"kind": "agent".eventsholds every token the agent was issued or refused, every exchange it made with the chain of agents behind it, and every policy decision it was in. -
Read the changes to the agent’s record. A quarantine or a change of status is in its change history, with the values before and after:
Terminal window curl https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/invoice-agent/history \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"The trail’s own
changespart comes back empty today.
Check it worked
Section titled “Check it worked”-
events.totalCountsays how many records there are in all; ask for the next page withpage=2. -
Sign in as
mayaand read your own trail with no id to know:Terminal window curl https://foobar.cvyuh.com/api/v0/am/audit/v1/trail/me \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"