mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-24 03:18:21 -05:00
[GH-ISSUE #16700] feat: Add File-Based Logging Support #18014
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?
Originally created by @kim-seokjin on GitHub (Aug 18, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16700
Check Existing Issues
Problem Description
Description:
Currently, Open WebUI
only outputs logs to the console. This can be problematic in production environments wherepersistent, file-based logsare required for auditing, debugging, and monitoring.Problem:
Both the documentation and the codebase show that logging is configured only for console output. This limitation can be critical in operational environments where log persistence and rotation are necessary.
Desired Solution you'd like
Proposed Solution:
Leverage Python’s built-in logging module with
TimedRotatingFileHandler. This allows logs to be rotated daily (e.g., at midnight) and automatically removes files older than a set retention period (e.g., 100 days).Example implementation(logging part in
env.py):Reference:
Python Docs – TimedRotatingFileHandler
Alternatives Considered
No response
Additional Context
No response
@tjbck commented on GitHub (Aug 18, 2025):
Refer to our loguru implementation.
@kim-seokjin commented on GitHub (Aug 19, 2025):
Thanks a lot for pointing this out. I learned something new because of you! @tjbck
After looking into logger.py, env.py, and audit.py, it seems that setting
AUDIT_LOG_LEVELin the.envfile to one of"METADATA","REQUEST", or"REQUEST_RESPONSE"should work. Could you confirm if that’s correct?