Skip to content

Audit Logging

khaled emits one INFO record with event: "key_access" when a Prograde or Retrograde key-server call returns. This includes successful and denied local and federated Retrograde requests, and errors encountered during either operation. Prograde records describe its key-access decision; they do not list individual federation release-policy evaluations.

These records describe the Key Service’s decisions and response construction. A successful record does not prove receipt by the client, encryption, decryption, or subsequent information sharing. Malformed requests and requests rejected by authentication or claims mapping before reaching the key server do not produce these events. GetSelf, assisted operations, federation identity requests, and administrative operations are outside this audit scope.

Use the existing logger with JSON output and INFO severity:

logging:
format: json
severity: info

No DEBUG logging is required. JSON is the recommended format for audit collection. The daemon writes to stderr; configure the existing service, container, or log-agent infrastructure to collect that stream, parse each JSON record, and forward records whose event equals key_access to the operator’s SIEM. For example, this filter selects records from a captured JSON log:

Terminal window
jq -c 'select(.event == "key_access")' khaled.jsonl

Diagnostic records share the stream but do not carry this event marker. Filter on event, rather than message text or severity alone. Existing HTTP request logs are DEBUG diagnostics; they are not additional key-access audit events. There is no dedicated audit sink, native SIEM integration, delivery guarantee, or persistent audit queue. Normal logger filtering applies: warn and error suppress these INFO records. The built-in logger defaults are JSON and ERROR, so operators must select INFO (or DEBUG) to collect audit events. Config-source values take precedence over the CLI/environment logging defaults.

FieldMeaning and presence
time, level, msgStandard slog fields: event emission timestamp in RFC 3339 format, INFO, and key-access decision.
eventAlways key_access; the collection marker.
operationPrograde or Retrograde.
outcomesuccess: the key-server call constructed a lease response; denied: it returned the existing access-denied error; error: another failure prevented completion.
policyDecisionallow or deny when the primary policy evaluation returned a decision; unavailable when it did not complete. An allowed decision can still have an error outcome. Federated Retrograde can have allow with denied when its existing captive/diagnostic checks reject access.
principalURIPrincipal identifier supplied by authentication and claims mapping; omitted if empty.
domainNameConfigured local CABE domain name.
correlationIDServer-generated request UUID from the HTTP logging middleware; absent for callers without that context.
requestIDOptional client-supplied X-Request-ID, accepted by HTTP middleware only when it parses as a UUID.
attributeSetDigestsha256: followed by lowercase hex SHA-256 of the canonical Attribute Set representation bytes, including for denied requests.
determiningPolicyCountNumber of determining policy IDs reported by the engine; present only when a decision is available. Zero means none were reported.
requireCaptiveCaptive requirement reported by the primary policy decision; present only with a decision. This is not the final lease’s captive status.
leaseExpiryExpiry of the constructed lease in UTC; present only on success.
principalClaimsConfigured, present claim names and their values; emitted only with a nonempty claims allowlist.
clientIPTransport-observed peer IP, without its port; emitted only when enabled and available. Forwarded headers are ignored. Behind a proxy, this is the proxy’s address.
attributeSetAttribute Set as a JSON object, with the redactions below; emitted only when enabled. The digest remains present.
determiningPolicyHashesSorted, deduplicated SHA-256 digests of determining policy identifier strings, not policy source text; emitted only when enabled and a decision is available. May be empty.
diagnosticCount, diagnosticHashesNumber of engine diagnostic strings and their sorted, deduplicated SHA-256 digests; emitted only when diagnostics are enabled and a decision is available.
reasonHashSHA-256 digest of the engine’s nonempty reason string; emitted only when diagnostics are enabled.

All digest fields use the sha256: prefix. Policy and diagnostic hashes permit correlation without copying engine-generated text into the audit stream. Raw policy IDs, reasons, diagnostics, and error messages are not audit fields.

All optional details are disabled by default. Add this logging block to an otherwise valid server configuration to record selected claims, the peer IP, and hashes of determining policy IDs:

logging:
format: json
severity: info
audit:
# Default: []. Exact claim names; no wildcard expansion.
principalClaims: [team, region]
# Default: false. Record the connection peer, not forwarded headers.
clientIP: true
# Default: false. Set true for the redacted Attribute Set object.
fullAttributeSet: false
# Default: false. Hash determining policy IDs, not their source text.
policyHashes: true
# Default: false. Set true for diagnostic counts and hashes.
diagnostics: false

Omitting audit, or using audit: {}, selects the default detail. Omitting an individual option selects its stated default. Invalid types and unknown audit options are rejected. The Configuration Reference provides the complete schema. Changes apply to subsequent calls through normal config reload; in-flight calls retain the detail settings captured at entry. These controls affect audit fields only; existing DEBUG HTTP diagnostics include remoteAddr independently of the audit clientIP option.

principalClaims is an explicit allowlist of claim names. Unlisted and missing claims are omitted. Optional claims and Attribute Set objects redact fields whose names contain token, password, credential, secret, privatekey, leasekey, plaintext, authorization, cookie, or lkat, or equal key or cek, ignoring case and the separators ., _, and -. Byte strings, unsupported Go values, and nesting beyond 16 levels are also replaced with [REDACTED]. Custom string, log, and JSON conversion methods are not invoked.

The audit code never serializes requests, leases, cryptographic keys, CEKs, LeaseRefs, LKATs, ARIN tokens, authentication headers, or credentials. The optional metadata controls do not enable those protocol fields. Only enable claim names and Attribute Set values known to be suitable for logging: name redaction cannot recognize secrets placed under unrelated application field names. Digests allow correlation and are not a confidentiality guarantee for predictable Attribute Sets or identifiers.

A successful Prograde request using the detail configuration above. The policy engine reported one determining policy ID, whose hash is recorded; the two listed claims were present on the principal:

{
"time": "2026-10-19T18:00:00Z",
"level": "INFO",
"msg": "key-access decision",
"event": "key_access",
"operation": "Prograde",
"outcome": "success",
"domainName": "default",
"attributeSetDigest": "sha256:c19a797fa1fd590cd2e5b42d1cf5f246e29b91684e2f87404b81dc345c7a56a0",
"principalURI": "spiffe://example.org/workload/a",
"determiningPolicyCount": 1,
"requireCaptive": false,
"policyDecision": "allow",
"leaseExpiry": "2026-10-19T18:05:00Z",
"correlationID": "042112e7-423b-478d-a257-260b828db2cb",
"principalClaims": {
"team": "blue",
"region": "west"
},
"clientIP": "192.0.2.10",
"determiningPolicyHashes": [
"sha256:3dbf88e893551005b92f187643a6207e5bc89b1f4dd06dfae8c3e5e92bb8b3d2"
]
}

A denied Retrograde request for the same Attribute Set, with default audit detail. No lease expiry or optional details are recorded:

{
"time": "2026-10-19T18:01:00Z",
"level": "INFO",
"msg": "key-access decision",
"event": "key_access",
"operation": "Retrograde",
"outcome": "denied",
"domainName": "default",
"attributeSetDigest": "sha256:c19a797fa1fd590cd2e5b42d1cf5f246e29b91684e2f87404b81dc345c7a56a0",
"principalURI": "spiffe://example.org/workload/b",
"determiningPolicyCount": 0,
"requireCaptive": false,
"policyDecision": "deny",
"correlationID": "a54a1700-17ad-4be7-8af3-b7b07ad4a0a4"
}