Files
supabase/apps/docs/content/guides/auth/audit-logs.mdx
63ea299a2b docs(auth): clarify ip_address is not included in audit logs (#43005)
Fixes #42997

Removed `ip_address` from the audit log example and clarified that
client IP addresses are stored in `auth.sessions`, but are not currently
included in Auth audit logs.

This aligns the documentation with the current behavior.

---

## I have read the CONTRIBUTING.md file.

YES

## What kind of change does this PR introduce?

Docs update

## What is the current behavior?

The documentation example includes `ip_address` in Auth audit logs, but
this field is not actually present in the audit logs.

## What is the new behavior?

The example no longer includes `ip_address`, and a note clarifies that
IP addresses are stored in `auth.sessions`, but not included in audit
logs.

## Additional context

N/A

---------

Co-authored-by: hallidayo <22655069+Hallidayo@users.noreply.github.com>
Co-authored-by: Nik Richers <nrichers@gmail.com>
Co-authored-by: Nik Richers <nik@validmind.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 02:09:02 +00:00

87 lines
4.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: 'auth-audit-logs'
title: 'Auth Audit Logs'
description: 'Monitor and track authentication events with audit logging.'
subtitle: 'Monitor and track authentication events with audit logging.'
---
Auth audit logs provide comprehensive tracking of authentication events in your Supabase project. Audit logs are automatically captured for all authentication events and help you monitor user authentication activities, detect suspicious behavior, and maintain compliance with security requirements.
## What gets logged
Supabase auth audit logs automatically capture all authentication events including:
- User sign-ups and sign-ins
- Password changes and resets
- Email verification events
- Token refresh and sign-out events
## Storage options
Audit logs are stored in:
- **External log storage** - Cost-efficient storage accessible through the dashboard
- **Postgres database** (optional) - Stored in the `auth.audit_log_entries` table, searchable via SQL, but uses additional database storage
You can enable or disable Postgres database storage to optimize your costs.
### Configuring audit log storage
1. Navigate to your project’s dashboard
2. Go to **Authentication**
3. Find the **Audit Logs** under the **Configuration** section
4. Toggle "Write audit logs to the database" on to enable or off to disable database storage
## Log format
Audit logs contain detailed information about each authentication event:
```json
{
"timestamp": "2025-08-01T10:30:00Z",
"user_id": "uuid",
"action": "user_signedup",
"ip_address": "192.168.1.1",
"user_agent": "Mozilla/5.0...",
"metadata": {
"provider": "email"
}
}
```
`ip_address` is recorded only for some events, such as MFA, passkeys, identity linking, and recovery codes. It is empty for most sign-up, sign-in, sign-out, and token events. To see the IP address for a session, check the `ip` column in `auth.sessions`.
### Log actions reference
| Action | Description |
| ------------------------------- | --------------------------------------- |
| `login` | User sign-in attempt |
| `logout` | User sign-out |
| `invite_accepted` | Team invitation accepted |
| `user_signedup` | New user registration |
| `user_invited` | User invitation sent |
| `user_deleted` | User account deleted |
| `user_modified` | User profile updated |
| `user_recovery_requested` | Password reset request |
| `user_reauthenticate_requested` | User reauthentication required |
| `user_confirmation_requested` | Email/phone confirmation requested |
| `user_repeated_signup` | Duplicate signup attempt |
| `user_updated_password` | Password change completed |
| `token_revoked` | Refresh token revoked |
| `token_refreshed` | Refresh token used to obtain new tokens |
| `generate_recovery_codes` | MFA recovery codes generated |
| `factor_in_progress` | MFA factor enrollment started |
| `factor_unenrolled` | MFA factor removed |
| `challenge_created` | MFA challenge initiated |
| `verification_attempted` | MFA verification attempt |
| `factor_deleted` | MFA factor deleted |
| `recovery_codes_deleted` | MFA recovery codes deleted |
| `factor_updated` | MFA factor settings updated |
| `mfa_code_login` | Sign in with MFA code |
| `identity_unlinked` | An identity unlinked from account |
## Limitations
- There may be a short delay before logs appear
- Query capabilities are limited to the dashboard interface