mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 07:43:10 -05:00
[PR #8509] [CLOSED] feat: add audit logging feature #9033
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/8509
Author: @victorstevansuse
Created: 1/13/2025
Status: ❌ Closed
Base:
dev← Head:feat/audits📝 Commits (10+)
e052038feat: add audit logging to file770be67feat: add loguru dependency77fdccffeat: add audit logging to fileed4af34feat: add audit context417fd5arefactor: delete audits models file1e8a217refactor: change audit logging middleware to avoid streaming issues and use context managera4fa929refactor: simplify audit logger66c13c4refactor: refactor log file output json24132d7chore: add asgiref dependency for advanced ASGI typesb08cf04chore: delete audit clutter from main📊 Changes
6 files changed (+201 additions, -2 deletions)
View changed files
📝
backend/open_webui/env.py(+9 -0)📝
backend/open_webui/main.py(+17 -2)➕
backend/open_webui/models/audits.py(+25 -0)➕
backend/open_webui/utils/audits.py(+148 -0)➕
backend/open_webui/utils/logger.py(+0 -0)📝
backend/requirements.txt(+2 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Loguru.AuditLoggerfor structured, file-based audit logs and a middleware to capture request/response data selectively.Added
AuditLoggerMiddlewareto intercept requests/responses, truncate large payloads, and schedule background audit logs.AuditLoggerclass that bindsauditable=Truefor logging user actions and metadata.ENABLE_AUDIT_LOGS,AUDIT_LOG_LEVEL, etc.) to control audit logging behaviour.Changed
Logurusinks for both console and audit logs.Deprecated
Removed
Fixed
Security
Breaking Changes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.