# Audit Logs

> Review who changed what in your LearnHouse organization with audit logs: what is recorded, how payloads are redacted, filters, CSV export and the API.

Audit logs record the changes people make in your organization, so administrators can see who did what and when. Use them for compliance, security reviews and troubleshooting.

> Audit logs need the Enterprise plan on LearnHouse Cloud, or the [Enterprise Edition](https://docs.learnhouse.app/enterprise) when self-hosted. On a self-hosted EE instance every organization is logged, whatever its plan.
> 

## Where to find them

Go to **Users** → **Audit Logs** in the dashboard. Only the **Admin** role can open them (Maintainers cannot), and the organization's [two-factor policy](https://docs.learnhouse.app/platform/users/two-factor) applies.

<img src="/img/pages/enterprise/audit-logs.webp" alt="The Audit Logs tab listing changes with their time, user, resource, path and method, IP address and status" width={1600} height={900} style={{ borderRadius: 10 }} />

## What gets recorded

LearnHouse records every `POST`, `PUT`, `PATCH` and `DELETE` request made by a signed-in member of the organization, by a Backoffice staff member, or by one of the organization's API tokens. Read-only requests are not recorded, and neither are anonymous requests or health checks.

| Field | Description |
| --- | --- |
| User | Who made the change (ID, username and avatar) |
| Action | The method and path, for example `PUT /api/v1/courses/course_123` |
| Method | `POST`, `PUT`, `PATCH` or `DELETE` |
| Path | The request path |
| Resource | The kind of item affected, taken from the path (for example `courses` or `users`) |
| Resource ID | The specific item, when the path has one |
| Status code | The HTTP response status |
| IP address | Where the request came from |
| Timestamp | When it happened |
| Payload | The request body, with sensitive fields removed |

## Sensitive data

Before a payload is stored, any field whose name contains `password`, `secret`, `token`, `api_key`, `apikey`, `private_key`, `credential`, `code`, `otp`, `reset` or `mfa` is **removed**, at any depth.

Some payloads are not stored in full:

- Bodies larger than 64 KB, and file uploads (multipart forms), are not read. The log notes that the payload was omitted.
- Stored payloads larger than 8 KB are replaced by an omission marker.

## Searching and filtering

| Control | Options |
| --- | --- |
| **Search by** | **Path & Method**, **Resource**, **User** (username, name or ID) or **IP Address** |
| Resource | **All Resources**, **User**, **Course** or **Organization** |
| Status | **All**, **200 OK**, **403**, **404** or **500** |
| Date | **All Time**, **Today**, **Last 7 Days**, **Last 30 Days** or **Custom Range** |

Click a row's payload to open it in **Event Payload**. Use **Refresh logs** to load new entries.

## CSV export

**Export** downloads the logs matching your filters as CSV, newest first, up to 50,000 rows. Columns: ID, Timestamp, User ID, Username, Action, Resource, Resource ID, Method, Path, Status Code and IP Address. Payloads are not included in the export.

## How logging works

Entries are first queued in Redis, then written to the database in batches every 60 seconds, so logging does not slow requests down. New entries can take up to a minute to appear.

> Audit logging needs Redis. If Redis is not configured, nothing is recorded. LearnHouse does not prune audit logs, so they are kept indefinitely.

## API

Admins can also read the logs with a signed-in session (API tokens are not accepted):

- `GET /api/v1/ee/audit_logs/?org_id=...` with `offset`, `limit` (up to 100) and the filters `user_id`, `username`, `name`, `action`, `resource`, `status_code`, `ip_address`, `start_date` and `end_date`.
- `GET /api/v1/ee/audit_logs/export` for the CSV.
