Files
litellm/tests/logging_callback_tests
shin-bot-litellm c7a22921dc feat: add standard_logging_payload_excluded_fields config option (#20831)
Adds a new config option to exclude specific fields from StandardLoggingPayload
before any callback receives it. This provides a general approach to control
what data is logged across ALL integrations (S3, GCS, Datadog, etc.).

## Changes

1. **litellm/__init__.py**: Added new global setting
   `standard_logging_payload_excluded_fields: Optional[List[str]] = None`

2. **litellm/integrations/custom_logger.py**: Modified
   `redact_standard_logging_payload_from_model_call_details()` to:
   - Remove specified fields entirely from the StandardLoggingPayload
   - Works alongside existing `turn_off_message_logging` feature
   - Excluded fields take precedence (removed rather than redacted)

3. **tests/**: Added comprehensive test suite with 17 tests covering:
   - Single/multiple field exclusion
   - Interaction with turn_off_message_logging
   - Original payload immutability
   - Config loading via setattr (proxy pattern)
   - Edge cases (empty list, non-existent fields, None standard_logging_object)

## Usage

```yaml
litellm_settings:
  success_callback: ["s3"]
  standard_logging_payload_excluded_fields: ["response", "messages"]
```

This removes the `response` and `messages` fields from logs before any
callback processes them, reducing log size and improving privacy compliance.

## Available Fields

The fields match StandardLoggingPayload TypedDict keys including:
- messages, response (large payload fields)
- metadata, hidden_params, model_parameters
- error_str, error_information
- And all other StandardLoggingPayload fields

Closes the need for per-integration flags like `s3_log_response`.
2026-02-10 22:16:41 -08:00
..
2024-11-12 00:16:35 +05:30
2025-04-10 14:04:57 -07:00
2025-10-25 10:19:24 -07:00
2025-10-25 10:19:24 -07:00
2025-10-04 10:39:17 -07:00
2026-01-21 14:41:35 -05:00