Skip to content

Audit log

GatewAI can emit a structured slog record for every LLM proxy request. Disabled by default to avoid unexpected log volume.

audit_log:
enabled: true
prompt: false # include raw request body — opt-in only

audit_log is a top-level config key (not per-service).

FieldDefaultDescription
enabledfalseEmit one log record per LLM request
promptfalseInclude the raw request body as a prompt field. Opt-in only — the body may contain PII.

Each record is a single slog.InfoContext call with the message "llm request" and the following key-value pairs:

FieldTypeDescription
service_typestringService type (e.g. llm)
modelstringClient-facing model alias
backend_modelstringModel name forwarded to the backend
providerstringProvider: openai, anthropic, ollama, passthrough
consumerstringConsumer name from consumer_header; empty if not configured
user_typestringUser type from user_type_header; empty if not configured
statusintHTTP status code returned to the client
duration_msint64End-to-end request duration in milliseconds
backend_urlstringBackend URL that served the request
streambooltrue if the request used SSE streaming
prompt_tokensintPrompt token count (absent for streaming responses)
completion_tokensintCompletion token count (absent for streaming responses)
promptstringRaw request body (only present when audit_log.prompt: true)
{
"time": "2026-03-05T10:04:32.123Z",
"level": "INFO",
"msg": "llm request",
"service_type": "llm",
"model": "chat-smart",
"backend_model": "meta-llama/Meta-Llama-3-8B-Instruct",
"provider": "passthrough",
"consumer": "alice",
"user_type": "user",
"status": 200,
"duration_ms": 842,
"backend_url": "http://vllm-primary.default.svc.cluster.local:8000",
"stream": false,
"prompt_tokens": 312,
"completion_tokens": 128
}