Monitoring, health and audit

Health check

GET /healthz returns an HTTP 200 with JSON describing the runtime:

{
  "status": "ok",
  "version": "1.14.2",
  "datastore": "kubernetes-configmap",
  "oauth_auth_codes": "kubernetes-configmap",
  "oauth_refresh_tokens": "kubernetes-configmap",
  "k8s_namespace": "ipseity",
  "entities": ["clients", "groups", "roles", "principals", "providers"],
  "k8s_init_source": "in-cluster",
  "k8s_init_error": "",
  "kubeconfig_path": "",
  "oidc_signing_ephemeral": false,
  "oidc_signing_alg": "RS256",
  "state_kv": "kubernetes-configmap",
  "audit": "stdout",
  "mailer": "smtp",
  "oidc_encryption_ephemeral": false
}
  • version reports the IPSEITY_VERSION env (set at deploy time) so you can confirm which build a pod is actually running.
  • Use it for readiness/liveness probes (as in the Orbit Deploy Deployment).
  • A non-zero k8s_init_error or oidc_signing_ephemeral: true in production indicates a misconfiguration worth investigating.
  • state_kv/datastore must read kubernetes/kubernetes-configmap in a multi-replica deployment — otherwise each replica holds per-process state and cross-replica flows (e.g. external-provider login callbacks) can fail.

Observability endpoints

  • GET /oidc/.well-known/openid-configuration — discovery.
  • GET /oidc/jwks — public signing keys.
  • GET /api/meta — entities, scopes, permissions, realms, issuer.
  • GET /api/session — your principal + realm + RBAC.
  • GET /api/realms (super) — per-realm counts and signing summaries.
  • GET /api/audit (admin.audit.read) — recent events for the target realm cached by the serving process.

Audit trail

Every audit event is written to container stdout as AUDIT followed by a single compact JSON object and a newline. Output is flushed immediately, and newlines inside values are escaped so event data cannot create extra log lines. This applies to Kubernetes and local development alike. For example:

AUDIT {"ts":1710000000,"realm":"customer-a","event_type":"auth.login","actor":"alice","status":"ok","remote_addr":"10.0.0.5","details":{}}

Event shape (the JSON after the prefix):

{
  "ts": 1710000000,
  "realm": "customer-a",
  "event_type": "auth.login",
  "actor": "alice",
  "status": "ok",
  "remote_addr": "10.0.0.5",
  "details": {}
}

realm is the request's target realm; it also distinguishes events from different tenants in a shared container log. Realm administration events may name the affected realm separately in details.realm.

GET /api/audit preserves the {"items": [...]} response and permission checks, but returns only the serving process's recent events for the selected realm. The cache retains at most IPSEITY_AUDIT_MAX_EVENTS events per realm (default 1000) and is empty after restart. With multiple replicas, successive requests may return different recent events. Set the limit to 0 to disable caching; all events are still logged. No audit ConfigMaps are created, listed or pruned.

See security.md for the full list of event types. Audit output failures are reported to stderr and do not fail the user's request.

Loki collection and retention

Configure the platform's log collector to ingest stdout from every replica. No Loki endpoint or credentials are needed in Ipseity. Retention, access control and historical searches belong to Loki; the API cache is for recent diagnostics. Log details include identity data such as usernames, email addresses and source IPs and are not encrypted by Ipseity's ConfigMap field cipher.

Filter audit events using your collector's actual stream labels, for example:

{app="ipseity"} |= "AUDIT "

Strip the prefix and parse the JSON to filter a realm or event type:

{app="ipseity"} | regexp "^AUDIT (?P<payload>.*)$" | line_format "{{.payload}}" | json | realm="customer-a" | event_type="auth.login"

Use the collector's labels to select Ipseity pods even when their events concern other realm namespaces. The event's realm field identifies the tenant.

Upgrading from ConfigMap auditing

After upgrading all replicas, new audit events go to stdout. Existing ConfigMaps labelled ipseity.io/component=audit remain untouched; they are not loaded into the recent-event cache or replayed to Loki. Export them before deleting them if historical retention is required. For each realm namespace:

kubectl get configmaps -n <realm> -l app=ipseity,ipseity.io/component=audit -o yaml > legacy-audit.yaml
# After preserving any required history and upgrading every replica:
kubectl delete configmaps -n <realm> -l app=ipseity,ipseity.io/component=audit

Use your configured app label if IPSEITY_LABEL_APP differs from ipseity.

Refresh-token cleanup

Consumed refresh tokens and explicitly revoked sessions are deleted immediately. A background worker sweeps all known realms on startup and every five minutes, removing expired, revoked and malformed refresh-token ConfigMaps without needing new login traffic. Failures are logged to stderr and retried; one realm's failure does not stop cleanup in the others. Existing expired records are removed by the first successful sweep after upgrading.

Multiple valid sessions can belong to one user: every authorization-code login creates a refresh token, whose default lifetime is 30 days (IPSEITY_REFRESH_TOKEN_TTL_SECONDS). Console sign-out finds the refresh token matching the access token's sid and revokes that session before clearing browser state. Other devices and clients stay signed in. If revocation fails, the console still clears local state and reports the failure. Closing a tab or letting an access token expire does not revoke its refresh token; those records remain until expiry or explicit revocation. Inspect them under Account → Sessions, then use Revoke All to remove unwanted live sessions left by older versions or abandoned browser sessions.

Logs

The server writes its own request/error logging to stdout/stderr (base BaseHTTPRequestHandler logs are the default). With 2+ replicas, aggregate container logs (e.g. via the platform's logging stack).

Troubleshooting

Symptom Check
Crash-loop at startup on signing key IPSEITY issue: missing/unreadable RS256 key. Ensure IPSEITY_OIDC_SIGNING_PRIVATE_KEY_FILE mounts readable by uid 10001 (fsGroup), or the signing Secret exists. Read /healthz.
Idle fallback to ephemeral encryption key IPSEITY_ENCRYPTION_KEY(FILE) set but unreadable → startup fails closed. Verify file perms/Secrets volume.
401 invalid token signature / invalid token key Signing key changed/lost; clients verifying against an old key. HTTPS/verifier caches; JWKS rotation timing.
429 on /oauth/* Rate limit configured and exceeded; check IPSEITY_RATE_LIMIT_* and retry-after semantics.
missing required permission … RBAC: the principal lacks the needed entity permission; check group/role/permission assignments.
account cannot log in after password change Off-device refresh tokens were revoked by the password change; re-authenticate.
Principal "locked" IPSEITY_AUTH_MAX_ATTEMPTS exceeded; lockout expires after IPSEITY_AUTH_LOCKOUT_SECONDS. To unlock immediately, delete that account's lockout:<username> and loginfail:<username> KV ConfigMaps in its home realm. Principal edits or deletion/recreation do not clear this separate state.
Realm not appearing Namespace not labelled with IPSEITY_REALM_LABEL; or RBAC lacks namespace list/watch. Discovery caches ~30s.
Expired refresh-token ConfigMaps accumulating Check stderr for refresh-token cleanup failed, namespace discovery, and ConfigMap list/delete RBAC. Sweeps run every five minutes. Live tokens remain until expiry or revocation.