Audit Logs
Full audit trail of all actions performed on your databases for compliance and debugging.
What are Audit Logs?
Audit logs record every significant action performed on your database resources — who did what, when, and from where. They are essential for security compliance, debugging, and accountability.
Viewing Audit Logs
curl -X GET https://api.lordbase.com/e/v1/developer/databases/{database_id}/audit-logs/ \
-H "Authorization: Bearer lb_pat_your_token"
Response:
[
{
"id": "990e8400-e29b-41d4-a716-446655440004",
"user_id": "12345",
"username": "[email protected]",
"action": "create_database",
"resource_type": "database",
"resource_name": "my-app-db",
"details": {"engine": "postgres", "display_name": "my-app-db"},
"ip_address": "192.168.1.100",
"created_at": "2026-01-15T10:35:00Z"
}
]
Filtering Logs
| Query Parameter | Description | Example |
|---|---|---|
user | Filter by user ID | ?user=12345 |
action | Filter by action type | ?action=create_database |
resource_type | Filter by resource | ?resource_type=backup |
Tracked Actions
| Action | Resource Type | Description |
|---|---|---|
create_database | database | Database provisioned |
delete_database | database | Database deleted |
pause_database | database | Database paused |
resume_database | database | Database resumed |
clone_database | database | Database cloned |
create_backup | backup | Backup initiated |
restore_backup | backup | Backup restored |
create_user | user | Database user created |
delete_user | user | Database user deleted |
enable_extension | extension | Extension enabled |
execute_query | query | SQL query executed |
Log Entry Fields
| Field | Description |
|---|---|
user_id | ID of the user who performed the action |
username | Email/name of the user |
action | Type of action performed |
resource_type | Type of resource affected |
resource_id | ID of the affected resource |
resource_name | Name of the affected resource |
details | Additional context (JSON) |
ip_address | IP address of the request |
user_agent | Browser/client identifier |
created_at | Timestamp of the action |
Best Practices
| Practice | Description |
|---|---|
| Regular review | Periodically review logs for unexpected activity |
| Alert on sensitive actions | Monitor delete and permission change events |
| Export for compliance | Download logs for regulatory requirements |
Next Steps
- Metrics — Monitor database health
- Security Best Practices — Secure your databases