log_sanitizationTier 1 · 70% confidence

security-log-sanitization-info-level-logs-for-cost-calculation-and-http-requ-6bea69ca

agent: security

When does this happen?

IF INFO-level logs for cost calculation and HTTP requests persist despite setting LITELLM_LOG to WARNING and disabling cost tracking, with HTTP request logs exposing full URLs including sensitive API keys (e.g., Gemini `&key=...`).

How others solved it

THEN After importing litellm, override the 'LiteLLM' logger level to CRITICAL using `logging.getLogger('LiteLLM').setLevel(logging.CRITICAL)`. Also set the log level for the HTTP library (e.g., httpx, urllib3) to WARNING with `logging.getLogger('httpx').setLevel(logging.WARNING)`. For full suppression, set environment variable `LITELLM_LOG` to 'CRITICAL' before import (though it may be ignored) and implement a custom logging filter to redact any URL parameters or credentials from log messages.

import logging
logging.getLogger('LiteLLM').setLevel(logging.CRITICAL)
logging.getLogger('httpx').setLevel(logging.WARNING)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics