File Format
Format: JSONL (JSON Lines) - one JSON object per line Default location:aip-audit.jsonl (configurable)
Characteristics:
- Append-only (immutable)
- One event per line
- Parseable by
jq,grep, log aggregation tools - Timestamp-ordered
Authorization Decision Events
Logged for everytools/call request and JSON-RPC method invocation.
Required Fields
ISO 8601 timestamp with millisecond precision.Format:
YYYY-MM-DDTHH:MM:SS.sssZ (UTC)Example: "2026-01-24T10:30:45.123Z"Request direction.
| Value | Description |
|---|---|
upstream | Client → MCP server (request) |
downstream | MCP server → Client (response) |
Authorization decision result.
| Value | Description |
|---|---|
ALLOW | Request permitted |
BLOCK | Request denied |
ALLOW_MONITOR | Would block, but allowed (monitor mode) |
RATE_LIMITED | Blocked due to rate limit |
ASK_APPROVED | User approved prompt |
ASK_DENIED | User rejected prompt |
Policy enforcement mode at decision time.
| Value | Description |
|---|---|
enforce | Violations are blocked |
monitor | Violations logged but allowed |
Whether a policy violation was detected.Example:
true if tool not in allowed_tools, even if mode: monitor allowed it through.Optional Fields
JSON-RPC method name (e.g.,
"tools/call", "tools/list", "initialize").Tool name for
tools/call requests.Example: "github_get_repo"Tool arguments. Should be redacted for sensitive data.Security note: Consider omitting or redacting this field in production.
Name of argument that failed validation (if applicable).Example:
"path"Regex pattern that failed to match (if applicable).Example:
"^/home/.*"v1alpha2 feature. Session UUID when identity is enabled.Format: UUID v4Example:
"550e8400-e29b-41d4-a716-446655440000"v1alpha2 feature. Token nonce for correlation with identity events.Example:
"abc123def456"v1alpha2 feature. SHA-256 hash of policy at decision time.Format: 64-character hex stringExample:
"a3c7f2e8d9b4f1e2c8a7d6f3e9b2c4f1a8e7d3c2b5f4e9a7c3d8f2b6e1a9c4f7"Example Authorization Events
Identity Events (v1alpha2)
Logged whenidentity.enabled: true. These events track token lifecycle and validation failures.
TOKEN_ISSUED
Logged when a new identity token is created.Event type:
"TOKEN_ISSUED"ISO 8601 timestamp.
Session UUID.
Token nonce.
ISO 8601 expiration timestamp.
Policy hash at issuance time.
TOKEN_ROTATED
Logged when a token is rotated before expiry.Event type:
"TOKEN_ROTATED"Previous token nonce.
New token nonce.
TOKEN_VALIDATION_FAILED
Logged when token validation fails.Event type:
"TOKEN_VALIDATION_FAILED"Validation error reason (see Error Codes).Possible values:
token_expiredpolicy_changedsession_mismatchbinding_mismatchreplay_detectedaudience_mismatchmalformed
REVOCATION
Logged when a token or session is revoked via the/v1/revoke endpoint.
Event type:
"REVOCATION"Revocation type:
"session" or "token"Session ID or token nonce that was revoked.
Human-readable reason for revocation.
Administrator who initiated revocation.
DLP Events
Logged when DLP patterns match in requests or responses.DLP_MATCH (Response)
Event type:
"DLP_MATCH""downstream" for response matches.Tool that returned sensitive data.
Name of the DLP pattern that matched.
Whether content was redacted.
DLP_REQUEST_REDACTION (v1alpha2)
Logged when DLP redacts content in a request.Event type:
"DLP_REQUEST_REDACTION"Whether the redacted request was forwarded to the MCP server.
If not forwarded, why redaction failed.
Querying Audit Logs
Using jq
Find all blocked requests:
Using grep
Find DLP matches:
Log Aggregation
AIP audit logs are compatible with:- ELK Stack (Elasticsearch, Logstash, Kibana)
- Splunk
- DataDog
- Grafana Loki
- CloudWatch Logs
Compliance and Retention
Immutability
Audit logs are append-only. Implementations must:- Never modify or delete existing log entries
- Use atomic append operations
- Protect log files with read-only permissions after writing
Retention Policies
Recommended retention periods:| Use Case | Retention | Rationale |
|---|---|---|
| Development | 7 days | Short-term debugging |
| Production | 90 days | Security incident response |
| Compliance (SOC 2) | 1 year | Audit requirements |
| Compliance (HIPAA) | 6 years | Legal requirements |
Sensitive Data
Best practices:- Redact
argsfield in production logs - Encrypt log files at rest (e.g., LUKS, AWS KMS)
- Restrict log file access to security team only
- Use separate log sinks for high-sensitivity environments
Next Steps
Policy YAML
Configure audit log behavior in policy
Error Codes
Understand decision results
Token Format
Identity token structure reference
Monitoring
Set up log aggregation and alerting