Skip to Content

Logging (on-prem)

Structured application logs you can feed to your own log platform, and how to correlate them.

On a self-hosted deployment, our core services emit structured logs built to feed Loki, ELK, CloudWatch, or Splunk. Bundled infrastructure components have their own vendor log formats — configure those collectors separately.

Format & levels

All services log JSON by default, one object per line, to stderr.

Env varApplies toDefaultEffect
SONUS_LOG_FORMATalljsontext for human key=value (local dev). Any other value resolves to json — prod never silently downgrades.
SONUS_API_LOG_LEVELapiINFODEBUG/INFO/WARN/ERROR
SONUS_GATEWAY_LOG_LEVELgatewayINFOas above
SONUS_AGENT_LOG_LEVELagentINFOas above

Core fields

Every line carries ts, level, service (api/gateway/agent), msg. Correlation:

  • api + gateway: request_id (echoes / propagates X-Request-Id).
  • agent: call_id (the LiveKit room name) stamped on every per-call line, and forwarded to the gateway as X-Request-Id — so agent.call_id == gateway.request_id for a call.

org_id appears on logs emitted inside the authenticated/RLS scope (not on the pre-auth access-log line).

Redaction (PII / secrets)

The api and gateway share one structured-attribute redactor; the Python agent and worker logger maintains the same normalized sensitive-key vocabulary. Matching is case-insensitive and ignores _ and -; categories include email, phone, address, date of birth, SSN, MRN, policy/card data, passwords, PINs, API keys, authorization/bearer values, secrets, and access/refresh tokens. A matched structured value becomes <redacted>; nested objects, maps, and arrays are traversed.

This is a key-based backstop, not content classification: it does not reliably catch a credential or PII interpolated into a free-form msg, an arbitrary error string, or an unrecognized attribute name. Log sensitive values only under a recognized structured key, never interpolated into a message. Content-bearing telemetry paths apply additional string redaction before logging, but still treat application logs as sensitive data, with access controls and retention limits.

This is operational application logging — distinct from the audit log, the workspace-isolated trail for public API mutations and privileged data access exposed through the audit-log API. Audit rows retain their core who/what/when evidence; call purge can replace call-linked metadata with a privacy-redaction marker.

On this page