Audit and login activity
auth_failures list, the RelataAuthFailureSpike alert, the sessions log channel and relata_stat_sessions are on develop. "On develop" means merged in the product repository but not in a release yet.What is recorded
RELATA_AUDIT_EVENTS selects the classes. The default is authn,authz,admin,write,read-denied.
| Class | Covers |
|---|---|
authn | Token mint, revoke, rotate and use; authentication failures; break-glass |
authz | Denied non-read requests; policy, role and ACL changes |
admin | Administrative actions, including job control, cache clears and query cancels |
write | Data writes |
read-denied | Reads refused by policy |
read | Allowed reads. Off by default |
The first five cannot be switched off; a setting that omits one stops startup. Add read to record allowed reads, and RELATA_AUDIT_READ_SAMPLE_RATIO to keep only a fraction. Reads not recorded are counted in relata_audit_reads_not_logged_total. Every SQL read of a relata_stat_* view is audited.
A record has executed_at, principal, tenant_id, purpose, query, decision (Allow, Deny or AuthFailure), rejection_reason, row_count, latency_ms, request_id, trace_id, source_ip and user_agent.
Query it
# the last failed sign-ins and refusals
curl -s -H "Authorization: Bearer $RELATA_API_KEY" \
"http://127.0.0.1:9090/v1/audit/log?decision=auth_failure&limit=50" | jq .
# everything one principal did since a time
curl -s -H "Authorization: Bearer $RELATA_API_KEY" \
"http://127.0.0.1:9090/v1/audit/log?principal=alice&since=2026-12-05T00:00:00Z" | jq .GET /v1/audit/log accepts limit (default 100, at most 1000), offset or cursor, purpose, principal, type, outcome (ok or error), since, until, decision (allow, deny or auth_failure) and request_id. GET /v1/audit/count returns the number of entries. A tenant-scoped token sees only its own entries; an unscoped caller must be an admin.
The files are in {RELATA_AUDIT_DIR} (default {data_dir}/audit): the live audit-local.jsonl and sealed audit-local.jsonl.<seq>.gz segments. Read them offline with zcat audit-local.jsonl.*.gz | jq ..
Failed sign-ins
relata_auth_failures_total{reason} counts refused authentication. reason is a fixed list:
reason | Meaning |
|---|---|
missing | No Authorization header, or an empty bearer |
malformed | Not Bearer <key>, or more than one header |
unknown_token | The key matches nothing: wrong, guessed or revoked |
expired | The key is past its expiry |
forbidden | An admin gate refused the credential |
rejected | The key authenticates, but the route still refused it |
throttled | The address is in the auth-failure lockout |
sum by (reason) (rate(relata_auth_failures_total[5m]))The top failing addresses and key fingerprints are the auth_failures key of GET /v1/system/stats. Each entry has kind (address or token), key, failures, first_seen_ns, last_seen_ns and last_reason. A key is shown only as sha256: and the first 12 hex digits of its hash, never the key itself. Operator and oversight keys only.
The alert RelataAuthFailureSpike fires when failures stay above 1 per second for 10 minutes. Every failure is also logged on the sessions log channel (see Logging).
Keys in use
relata_stat_sessions has one row per registry token that has made a request since the process started.
SELECT description, fingerprint, last_address, requests_last_hour
FROM relata_stat_sessions ORDER BY last_seen_ns DESC
SELECT * FROM relata_stat_sessions WHERE failures_last_hour > 0| Column | Meaning |
|---|---|
token_id, fingerprint | The registry token id, and sha256: plus 12 hex digits of its hash. Never the secret. The same form auth_failures uses, so a key can be followed from failures to use. |
description, tenant, role | As minted. |
first_seen_ns, last_seen_ns | First and last request, nanoseconds UTC. |
last_address, last_door, doors | Where the last request came from, and every door used. |
requests, requests_last_hour, failures_last_hour | Request counts; failures are answers 401 or 403. |
Operator and oversight keys only. A guessed or revoked key never adds a row, and the static RELATA_ADMIN_TOKEN is not listed. At most RELATA_STAT_SESSIONS_MAX rows (default 256); a new token then evicts the least recently seen row.
The token registry has its own trail on the admin listener: GET /admin/tokens, GET /admin/tokens/audit and GET /admin/break-glass/audit. A tenant reads its own token trail at GET /v1/auth/tokens/self/audit.
Health of the audit pipeline
| Signal | Meaning |
|---|---|
relata_audit_drops_total, alert RelataAuditDrops | Records were dropped under backpressure. |
relata_audit_chain_valid | In the open build, 0 only after drops. It is not an integrity check. |
relata_audit_archive_lag_segments, alerts RelataAuditArchiveLag, RelataAuditArchiveFailing | Sealed segments waiting to be archived. |
RelataAuditDirLowSpace | The audit volume is low on space. |
RELATA_AUDIT_FAIL_CLOSED=true | Refuse audited requests when the audit sink cannot take records. |
Segments are rotated, compressed and capped by size and age. Set RELATA_AUDIT_ARCHIVE_URL to ship sealed segments to an archive. RELATA_AUDIT_OTLP_ENDPOINT forwards security events (never allowed reads or statement text) to a collector you run. Credentials are scrubbed from every free-text field before a record is written. See the audit operations guide.
What is coming
Further audit and session items are tracked in #7849.