LLM Proxy Audit Logging

Complete visibility into every API call. Track requests, monitor performance, ensure compliance, and debug issues with comprehensive audit trails for all your LLM operations.

100%
Request Capture
7+ yrs
Retention
Real-time
Alerting
📊 Live Audit Stream
2025-03-17 14:23:45 POST /v1/chat/completions 200 ✓
2025-03-17 14:23:42 GET /v1/models 200 ✓
2025-03-17 14:23:40 POST /v1/chat/completions 429 ⚠
2025-03-17 14:23:38 POST /v1/embeddings 500 ✗
2025-03-17 14:23:35 POST /v1/chat/completions 200 ✓

Audit Logging Features

Comprehensive logging capabilities designed for compliance, security, and operational excellence.

📝

Request Logging

Capture every API request with full details including headers, body, parameters, and authentication context.

  • Full request capture
  • Header sanitization
  • Body redaction options
  • Timing metadata
📤

Response Logging

Record complete API responses including status codes, headers, body content, and performance metrics.

  • Status code tracking
  • Response time measurement
  • Token usage capture
  • Error detail logging
🔍

Search & Filter

Powerful search capabilities to find specific requests by user, endpoint, status, time range, or custom criteria.

  • Full-text search
  • Advanced filtering
  • Saved queries
  • Export capabilities
📊

Analytics Dashboard

Visual dashboards showing usage patterns, error rates, performance trends, and cost allocation.

  • Real-time metrics
  • Usage trends
  • Cost tracking
  • Custom reports
🔔

Real-time Alerts

Configure alerts for anomalies, errors, rate limits, or custom conditions based on log patterns.

  • Anomaly detection
  • Error rate alerts
  • Slack/Email integration
  • Custom thresholds
🔒

Data Retention

Configurable retention policies with secure storage, automatic cleanup, and compliance-ready archiving.

  • Custom retention periods
  • Immutable storage
  • Auto-archival
  • Legal hold support

Log Entry Types

Different types of audit logs captured for comprehensive visibility

📥

Request Logs

  • Timestamp ISO 8601 format
  • Method GET/POST/PUT/DELETE
  • Endpoint /v1/chat/completions
  • User ID Authenticated user
  • Client IP Source address
  • Model gpt-4, claude-3
📤

Response Logs

  • Status Code 200/400/429/500
  • Latency Response time ms
  • Tokens Used Prompt + completion
  • Model Version Specific model used
  • Finish Reason stop/length/error
  • Cache Status hit/miss
⚠️

Error Logs

  • Error Type RateLimit/Timeout
  • Error Message Detailed message
  • Stack Trace Debug info
  • Retry Count Retry attempts
  • Fallback Used Yes/No
  • Resolution Auto/Manual
🔐

Security Logs

  • Auth Method API Key/OAuth
  • Key ID Partial key shown
  • Permission Granted scopes
  • Rate Limit Current usage %
  • Anomaly Score Risk assessment
  • Geo Location Country/Region

Compliance Ready

Built-in compliance features for regulatory requirements

SOC

SOC 2 Type II

Complete audit trail for SOC 2 compliance

GDPR

GDPR Compliant

Data handling meets GDPR requirements

HIPAA

HIPAA Ready

PHI-safe logging with redaction

PCI

PCI DSS

Payment data protection standards

Dashboard Capabilities

📈 Real-time Monitoring

Live view of all API requests as they flow through your proxy with instant status updates.

📊 Usage Analytics

Detailed breakdown of API usage by user, endpoint, model, and time period.

💰 Cost Tracking

Monitor token usage and associated costs across all your LLM API calls.

⚡ Performance Metrics

Track latency, throughput, and error rates to optimize your API performance.

🔔 Alert Management

Configure and manage alerts for anomalies, errors, and custom conditions.

📋 Report Generation

Create custom reports for stakeholders with scheduled delivery options.

Integration Example

audit_log_config.py Python
# Configure comprehensive audit logging
from llm_proxy.audit import AuditConfig, LogExporter

config = AuditConfig(
    # Enable all log types
    log_requests=True,
    log_responses=True,
    log_errors=True,
    log_security=True,
    
    # Retention settings
    retention_days=2555,  # 7 years
    archive_after=90,    # Archive after 90 days
    
    # Privacy settings
    redact_pii=True,
    redact_headers=["authorization", "api-key"],
    
    # Export configuration
    exporters=[
        LogExporter("elasticsearch", endpoint="http://logs.company.com"),
        LogExporter("s3", bucket="audit-logs-backup"),
    ]
)

Related Resources

Start Logging Today

Get complete visibility into your LLM API operations with our comprehensive audit logging solution.

Get Started Free →