> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/ai-in-umbraco/19.latest/backoffice/audit-logs.md).

# Audit Logs

View and analyze AI operation audit logs.

Every AI operation (chat completion, embedding generation) is logged with detailed information about the request, response, timing, and outcome. Use audit logs for monitoring, debugging, and compliance.

{% hint style="info" %}
Audit logs are stored in the `umbracoAIAuditLog` database table.
{% endhint %}

## Accessing Audit Logs

1. Navigate to the **AI** section in the main navigation.
2. Click **Audit Logs** in the tree.

## Understanding the Log List

![The audit logs list with timestamps, users, features, and token counts](https://23555065-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWUtW271qML1SMLKyLBYt%2Fuploads%2Fgit-blob-8c42bb6bc3c19c19c2ddbdf490b0a27cc6948515%2Fbackoffice-audit-log-list.png?alt=media)

The log list shows recent AI operations:

| Column     | Description                                         |
| ---------- | --------------------------------------------------- |
| Time       | When the operation started                          |
| Status     | Outcome (Succeeded, Failed, etc.)                   |
| Capability | Type of operation (Chat, Embedding, Speech-to-Text) |
| Profile    | Which profile was used                              |
| Provider   | AI provider (OpenAI, Anthropic, etc.)               |
| Model      | Specific model used                                 |
| User       | Who initiated the operation                         |
| Tokens     | Total tokens used                                   |
| Duration   | How long the operation took                         |

## Filtering Logs

Use the filter options to narrow results:

| Filter     | Description                         |
| ---------- | ----------------------------------- |
| Date Range | From and To dates                   |
| Status     | Succeeded, Failed, Blocked, Running |
| Capability | Chat, Embedding, Speech-to-Text     |
| Profile    | Specific profile                    |
| Provider   | Specific provider                   |
| User       | Specific user                       |

### Example Filters

* **Failed operations today**: Status = Failed, Date = Today
* **High token usage**: Sort by Tokens descending.
* **Specific user activity**: User = <john@example.com>

## Viewing Log Details

Click a log entry to view full details:

![Audit log detail showing status, user, profile, and prompt content](https://23555065-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWUtW271qML1SMLKyLBYt%2Fuploads%2Fgit-blob-5204b35951735a46929610fc4a639257aa591ba0%2Fbackoffice-audit-log-detail.png?alt=media)

### Summary

* Start time, end time, duration
* Status and any error information
* User who initiated the operation

### AI Configuration

* Profile used (with version)
* Provider and model
* Feature type (prompt, agent, or direct)

### Token Usage

* Input tokens (request)
* Output tokens (response)
* Total tokens

### Content (if captured)

Depending on the configuration:

* **Prompt snapshot** - The actual request sent (if `PersistPrompts` is enabled)
* **Response snapshot** - The AI's response (if `PersistResponses` is enabled)

{% hint style="info" %}
Content snapshots are controlled by the `PersistPrompts` and `PersistResponses` configuration options. Both default to true.
{% endhint %}

## Status Values

| Status             | Description                        |
| ------------------ | ---------------------------------- |
| **Succeeded**      | Operation completed successfully.  |
| **Failed**         | Operation encountered an error.    |
| **Running**        | Operation is in progress.          |
| **Blocked**        | Blocked by a guardrail rule.       |
| **Cancelled**      | Operation was cancelled.           |
| **PartialSuccess** | Some parts succeeded, some failed. |

## Error Categories

When operations fail, the error category helps diagnose the issue:

| Category          | Description                   |
| ----------------- | ----------------------------- |
| Authentication    | Authentication failure        |
| RateLimiting      | Provider rate limit exceeded  |
| ModelNotFound     | Requested model not available |
| InvalidRequest    | Invalid request parameters    |
| ServerError       | Provider server error         |
| NetworkError      | Network connectivity issue    |
| ContextResolution | Context resolution failure    |
| ToolExecution     | Tool execution failure        |
| GuardrailBlocked  | Blocked by guardrail rule     |
| Unknown           | Unclassified error            |

## Deleting Logs

To delete a specific log:

1. Select the log entry.
2. Click **Delete**.
3. Confirm the deletion.

{% hint style="warning" %}
Deleting audit logs is permanent. Consider your compliance requirements before deletion.
{% endhint %}

## Cleanup

To remove old logs:

1. Click **Cleanup** in the toolbar.
2. Specify how old logs should be (e.g., 90 days).
3. Confirm the cleanup.

### Automatic Cleanup

Configure audit log options in `appsettings.json`:

{% code title="appsettings.json" %}

```json
{
    "Umbraco": {
        "AI": {
            "AuditLog": {
                "Enabled": true,
                "RetentionDays": 14,
                "PersistPrompts": true,
                "PersistResponses": true,
                "PersistFailureDetails": true,
                "RedactionPatterns": []
            }
        }
    }
}
```

{% endcode %}

| Property                | Default | Description                                    |
| ----------------------- | ------- | ---------------------------------------------- |
| `Enabled`               | `true`  | Whether audit logging is enabled               |
| `RetentionDays`         | `14`    | Number of days to retain logs before cleanup   |
| `PersistPrompts`        | `true`  | Store prompt snapshots in logs                 |
| `PersistResponses`      | `true`  | Store response snapshots in logs               |
| `PersistFailureDetails` | `true`  | Store failure details in logs                  |
| `RedactionPatterns`     | `[]`    | Regex patterns for redacting sensitive content |

## Related

* [Usage Analytics](/ai-in-umbraco/19.latest/backoffice/usage-analytics.md) - Aggregated statistics
* [Audit Logs API](/ai-in-umbraco/19.latest/management-api/audit-logs.md) - Programmatic access


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/ai-in-umbraco/19.latest/backoffice/audit-logs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
