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 var | Applies to | Default | Effect |
|---|---|---|---|
SONUS_LOG_FORMAT | all | json | text for human key=value (local dev). Any other value resolves to json — prod never silently downgrades. |
SONUS_API_LOG_LEVEL | api | INFO | DEBUG/INFO/WARN/ERROR |
SONUS_GATEWAY_LOG_LEVEL | gateway | INFO | as above |
SONUS_AGENT_LOG_LEVEL | agent | INFO | as above |
Core fields
Every line carries ts, level, service (api/gateway/agent),
msg. Correlation:
- api + gateway:
request_id(echoes / propagatesX-Request-Id). - agent:
call_id(the LiveKit room name) stamped on every per-call line, and forwarded to the gateway asX-Request-Id— soagent.call_id == gateway.request_idfor 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.