From 594ddbdee141c2cdaab9b46c7dde2a21e3b0259d Mon Sep 17 00:00:00 2001 From: Avani-prajapati Date: Fri, 22 May 2026 16:36:21 +0530 Subject: [PATCH] docs(logging): document LITELLM_DISABLE_REDACT_SECRETS opt-out and dict-key redaction in CredentialScrubberFilter --- litellm/_logging.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/litellm/_logging.py b/litellm/_logging.py index 9cadbb72a61..6c73149e56e 100644 --- a/litellm/_logging.py +++ b/litellm/_logging.py @@ -459,9 +459,18 @@ def _scrub_secrets(text: str) -> str: class CredentialScrubberFilter(logging.Filter): - """Logging filter that redacts credential values from all log records.""" + """Logging filter that redacts credential values from all log records. + + Complements SecretRedactionFilter (value-shape matching) by matching on + secret key names (api_key=, encryption_key=, redis_password=, …). + + Opt-out: set LITELLM_DISABLE_REDACT_SECRETS=true to disable all redaction. + Dict args: keys matching _SECRET_KEY_NAME_RE are redacted regardless of + value type; other keys have their string values pattern-scrubbed. + """ def filter(self, record: logging.LogRecord) -> bool: + # Honour the LITELLM_DISABLE_REDACT_SECRETS opt-out env var. if not _ENABLE_SECRET_REDACTION: return True if record.msg and isinstance(record.msg, str):