# Record fields and examples

> Every field of an audit record, a full sign-in, failed sign-in and token record, and the ids that tie the records of one request, one sign-in and one token together.

Every record on a user's or agent's trail has the same shape: what happened, when, how it went, who it is about, and
the ids that tie it to the rest of its work. This page lists each field, shows three full records, and says how to
follow a piece of work from one record to the next.

## Before you begin

- **Privilege:** none to read your own records; `READ` on the realm (`RealmViewer` or `RealmOwner`) to read anyone
  else's. See [Read a user's or agent's trail](/audit-reports/audit-trail/read-a-trail/).
- **Where:** the API. Records come back in `events.data` of a trail read.

## The fields of a record

| Field | What it holds |
|---|---|
| `id` | The record's own id |
| `eventType` | What happened, such as `LOGIN` or `TOKEN_ISSUED`: see [What is recorded](/audit-reports/audit-trail/what-is-recorded/) |
| `eventTime` | When it happened, in UTC, written as `2026-12-04 10:15:02.123456 UTC` |
| `result` | `SUCCESSFUL` or `FAILED` |
| `userId` | Who the record is about: a user's or agent's id, the client that asked for a refused token, or, for a few records, the name typed at sign-in (see [Good to know](#good-to-know)) |
| `principals` | Who acted: for a sign-in, the names signed in; for a token, the chain of agents acting, outermost first. Empty when only the subject acted |
| `context` | The event's own detail: see each example below |
| `entries` | For a sign-in, one entry per step: `moduleId`, `result` (`succeeded`, `ignored` or `failed`), `code` for a failure, and `info` with the address the request came from (`ipAddress`) |
| `trackingIds` | The ids that tie this record to others: see [Follow one piece of work](#follow-one-piece-of-work) |
| `traceId`, `spanId`, `parentSpanId`, `transactionId` | The request the record was written in |
| `component` | The part of the realm that wrote it, such as `authentication` |
| `realm` | Your realm |

## Examples

### A sign-in: `LOGIN`

`maya` signs in with her password. The record is under her id, and its one step says where she signed in from:

```json
{
  "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>"
}
```

`context` holds the strength of the sign-in (`authLevel`) and the session's limits in seconds; `maxSessionSecs` and
`maxIdleSecs` are your realm's session settings at the time.

### A failed sign-in: `LOGIN_FAILED`

`maya`'s password is refused. The record is under her id, with a stable `code` for why and the name as it was typed:

```json
{
  "id": "<record id>",
  "eventType": "LOGIN_FAILED",
  "eventTime": "<event time>",
  "result": "FAILED",
  "userId": "<maya's id>",
  "principals": null,
  "context": { "code": "AUTH_INVALID_PASSWORD", "principalAttempted": true, "name": "Maya" },
  "entries": null,
  "trackingIds": { "authId": "<sign-in attempt id>" },
  "traceId": "<trace id>",
  "spanId": "<span id>",
  "parentSpanId": null,
  "transactionId": "<transaction id>",
  "component": "authentication",
  "realm": "<your realm>"
}
```

| `code` | What it means |
|---|---|
| `AUTH_INVALID_PASSWORD` | A wrong password or code |
| `AUTH_INVALID_PASSWORD_WARNED` | A wrong password, and the user was told how many attempts are left |
| `AUTH_MAX_ATTEMPTS` | The attempt that locked the account |
| `AUTH_USER_LOCKED` | An attempt while the account was locked, right password or not |
| `AUTH_INVALID_USERNAME` | A name the step couldn't accept |
| `AUTH_USER_INACTIVE` | The account is inactive |
| `AUTH_ACCOUNT_EXPIRED` | The account has expired |
| `AUTH_LOGIN_FAILED` | Any other refusal by a sign-in step |
| `AUTH_INTERNAL` | The realm couldn't complete the sign-in; try again |

A failed sign-in's record doesn't carry its steps or the address it came from today. A sign-in with a name the realm
doesn't hold is recorded under that name, not under anyone's id.

### A token: `TOKEN_ISSUED`

The app `https://app.example.com` exchanges `maya`'s authorization code for tokens. The record is under her id and
says what was asked, what was granted, and the key the token is bound to, if any:

```json
{
  "id": "<record id>",
  "eventType": "TOKEN_ISSUED",
  "eventTime": "<event time>",
  "result": "SUCCESSFUL",
  "userId": "<maya's id>",
  "principals": [],
  "context": {
    "clientId": "<the app's client id>",
    "grantType": "authorization_code",
    "principalType": "user",
    "asked": { "scope": ["openid", "profile"], "resource": [] },
    "granted": { "scope": ["openid", "profile"], "audience": "<the app's client id>" },
    "bound": null
  },
  "entries": null,
  "trackingIds": {
    "tokenId": "<the token's jti>", "family": "<refresh family>", "sid": "<sign-in id>"
  },
  "traceId": "<trace id>",
  "spanId": "<span id>",
  "parentSpanId": null,
  "transactionId": "<transaction id>",
  "component": "authentication",
  "realm": "<your realm>"
}
```

A refused token request is `"result": "FAILED"`, under the client that asked, with `context.error` and
`context.reason` saying why. For an agent acting for `maya`, `principalType` is `agent` and `principals` lists the
agents in the chain. `bound` holds the thumbprint of the key a sender-constrained token is bound to.

## Follow one piece of work

Each id in a record ties it to the other records of the same work:

| Id | Where | Ties together |
|---|---|---|
| `trackingIds.sid` | `LOGIN`, `SESSION_UPGRADED`, `LOGOUT`, `TOKEN_ISSUED` | One sign-in and everything it led to: the session, every step-up that continued it, and every token issued from it. It is the same value as the `sid` claim in those tokens |
| `trackingIds.sessionName` | `LOGIN`, `SESSION_UPGRADED`, `LOGOUT` | One session, from its start to its sign-out. A name for the session, never its cookie |
| `trackingIds.authId` | `LOGIN_STARTED` through `LOGIN` or `LOGIN_FAILED` | One sign-in attempt, page by page. Spent when the attempt ends |
| `trackingIds.tokenId` | `TOKEN_ISSUED`, `TOKEN_EXCHANGED`, `TOKEN_REVOKED` | One token: its `jti` claim |
| `trackingIds.parentTokenId` | `TOKEN_EXCHANGED` | The token an exchange started from, so a chain of exchanges reads back to its first token |
| `trackingIds.family` | `TOKEN_ISSUED`, `TOKEN_REVOKED` | A refresh token and every token it was rotated into |
| `traceId` | Every record | Every record one request wrote |

For example, to find every token a sign-in led to, take the `sid` of the `LOGIN` record and look for the
`TOKEN_ISSUED` records with the same `trackingIds.sid`. To match a token you hold to its record, decode its `jti` and
look for that `trackingIds.tokenId`.

## Limits and defaults

| What | Value |
|---|---|
| Records per trail page | 20 by default, 100 at most |
| Order | Newest first by `eventTime` |
| Values that never appear | Passwords, secrets, session cookies, tokens, keys |

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| A field is `null` | The record has nothing for it, such as `entries` on a token record | Read the fields the event carries, as in the examples |
| No `ACCOUNT_LOCKED` record on a locked user's trail | Lockout records follow the name typed, in lower case, not the user's id | Read `?person=maya`, the name in lower case: see [Look into a locked account](/audit-reports/guides/look-into-a-locked-account/) |
| A token's record isn't under the user | The request was refused before a user was known | Read the trail of the client that asked |

## Good to know

- **Lockout records follow the name typed.** `AUTH_FAILURE_RECORDED`, `ACCOUNT_LOCKED` and `LOCKOUT_CLEARED` are
  recorded under the sign-in name as typed, in lower case, not under the user's id, so they aren't on a trail read by
  id today. Read them by naming the user in lower case (`?person=maya`). A user's `LOGIN_FAILED` records are under
  their id.
- **`eventTime` isn't RFC 3339 yet.** It is written with a space and a `UTC` suffix; parse it as such.

## Related

- [What is recorded](/audit-reports/audit-trail/what-is-recorded/): every event and when it is written.
- [Read a user's or agent's trail](/audit-reports/audit-trail/read-a-trail/): reading the records.
