What happened?
Bug: turn_off_message_logging Does Not Redact Request Messages in proxy_server_request Field When Stored to Database
Description
When using turn_off_message_logging: true with store_prompts_in_spend_logs: true, the response is correctly redacted in spend logs, but the request messages remain unredacted. This creates a security/privacy issue where sensitive request data is stored in the database despite redaction being enabled.
Environment
- LiteLLM Version:
main-stable (latest as of 2025-11-06)
- Database: PostgreSQL
- Deployment: Docker Compose
Configuration
model_list:
- model_name: gpt-4.1-mini
litellm_params:
model: gpt-4.1-mini
api_base: https://litellm.com
api_key: sk-xxxxx
general_settings:
store_model_in_db: true
store_prompts_in_spend_logs: true
litellm_settings:
turn_off_message_logging: true
Expected Behavior
When turn_off_message_logging: true is set, both request and response should be redacted before being stored in the LiteLLM_SpendLogs table.
Actual Behavior
- ✅ Response: Correctly shows
{"text": "redacted-by-litellm"}
- ❌ Request: Full unredacted request messages are stored in the
proxy_server_request field in metadata column
Reproduction Steps
- Configure LiteLLM proxy with the config above and the docker-compose.yml found in the repository
- Run docker-compose up
- Make a request:
curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk-1234' \
--data '{
"model": "gpt-4.1-mini",
"messages": [
{
"role": "user",
"content": "what llm are you"
}
]
}'
- Navigate to the UI and find the logs
- Find your request
- Find that the log for the request shows the response redacted but the request fully present without any redaction
Relevant log output
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
1.79.0-stable
Twitter / LinkedIn details
No response
What happened?
Bug:
turn_off_message_loggingDoes Not Redact Request Messages inproxy_server_requestField When Stored to DatabaseDescription
When using
turn_off_message_logging: truewithstore_prompts_in_spend_logs: true, the response is correctly redacted in spend logs, but the request messages remain unredacted. This creates a security/privacy issue where sensitive request data is stored in the database despite redaction being enabled.Environment
main-stable(latest as of 2025-11-06)Configuration
Expected Behavior
When
turn_off_message_logging: trueis set, both request and response should be redacted before being stored in theLiteLLM_SpendLogstable.Actual Behavior
{"text": "redacted-by-litellm"}proxy_server_requestfield inmetadatacolumnReproduction Steps
Relevant log output
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
1.79.0-stable
Twitter / LinkedIn details
No response