mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
docs(logging): document LITELLM_DISABLE_REDACT_SECRETS opt-out and dict-key redaction in CredentialScrubberFilter
This commit is contained in:
parent
c0c8cc01ff
commit
594ddbdee1
1 changed files with 10 additions and 1 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue