mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
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`. |
||
|---|---|---|
| .. | ||
| gcs_pub_sub_body | ||
| langfuse_expected_request_body | ||
| base_test.py | ||
| conftest.py | ||
| create_mock_standard_logging_payload.py | ||
| gettysburg.wav | ||
| log.txt | ||
| test_alerting.py | ||
| test_amazing_s3_logs.py | ||
| test_assemble_streaming_responses.py | ||
| test_azure_blob_storage.py | ||
| test_bedrock_knowledgebase_hook.py | ||
| test_built_in_tools_cost_tracking.py | ||
| test_custom_callback_router.py | ||
| test_datadog.py | ||
| test_datadog_llm_obs.py | ||
| test_dynamic_otel_keys.py | ||
| test_gcs_pub_sub.py | ||
| test_generic_api_callback.py | ||
| test_humanloop_unit_tests.py | ||
| test_langfuse_e2e_test.py | ||
| test_langfuse_unit_tests.py | ||
| test_langsmith_unit_test.py | ||
| test_log_db_redis_services.py | ||
| test_logging_redaction_e2e_test.py | ||
| test_moderations_api_logging.py | ||
| test_opentelemetry_unit_tests.py | ||
| test_otel_logging.py | ||
| test_pagerduty_alerting.py | ||
| test_posthog.py | ||
| test_spend_logs.py | ||
| test_sqs_logger.py | ||
| test_standard_logging_payload.py | ||
| test_standard_logging_payload_excluded_fields.py | ||
| test_token_counting.py | ||
| test_unit_test_litellm_logging.py | ||
| test_unit_tests_init_callbacks.py | ||
| test_view_request_resp_logs.py | ||