Summary
Current OpenAI usage logging (openai-usage-logging fragment) captures token counts and metadata (model, tenant, subscription) but NOT the actual prompt text or completion text. There is no audit trail of what was asked and what was returned.
Gap
Government AI governance frameworks often require audit trails for model interactions - what prompts were sent, what responses returned, and whether any content safety issues were flagged. Without this, compliance audits have visibility into "how much" but not "what."
Proposed Implementation
- Create a new
audit-logging policy fragment that captures:
context.Request.Body (post-PII-redaction, so anonymized)
context.Response.Body (completion text)
- Content safety verdict (if
llm-content-safety is implemented)
- Tenant, subscription, model, and timestamp metadata
- Log to Application Insights custom events (or a dedicated Log Analytics workspace)
- Make it opt-in per tenant via an
audit_logging_enabled flag in tenant tfvars
- Add the flag to
templatefile() variables in stacks/apim/locals.tf
Considerations
- Privacy: PII redaction runs before audit logging, so logged prompts would be anonymized for OpenAI requests
- Storage costs: Full prompt logging significantly increases App Insights ingestion costs - consider sampling or a separate workspace
- Retention: Define retention policies aligned with BC Gov records management
- Data residency: Ensure logs stay in Canada East
Prerequisites
- Confirm BC Gov audit requirements for AI model interactions
- Assess App Insights cost impact with estimated request volume
- Determine if a separate Log Analytics workspace is needed for audit data
Severity
MEDIUM - Depends on specific BC Gov audit requirements for AI services.
Context
Identified during APIM multi-tenancy and AI gateway policy gap analysis (Feb 2026).
Summary
Current OpenAI usage logging (
openai-usage-loggingfragment) captures token counts and metadata (model, tenant, subscription) but NOT the actual prompt text or completion text. There is no audit trail of what was asked and what was returned.Gap
Government AI governance frameworks often require audit trails for model interactions - what prompts were sent, what responses returned, and whether any content safety issues were flagged. Without this, compliance audits have visibility into "how much" but not "what."
Proposed Implementation
audit-loggingpolicy fragment that captures:context.Request.Body(post-PII-redaction, so anonymized)context.Response.Body(completion text)llm-content-safetyis implemented)audit_logging_enabledflag in tenant tfvarstemplatefile()variables instacks/apim/locals.tfConsiderations
Prerequisites
Severity
MEDIUM - Depends on specific BC Gov audit requirements for AI services.
Context
Identified during APIM multi-tenancy and AI gateway policy gap analysis (Feb 2026).