Team logging
Team logging gives each team its own copy of its request logs in the observability project that team owns, without the platform team running one gateway per team. A team callback attaches a destination and its credentials to a team, so every request made with that team's keys is logged there, in addition to or instead of the gateway wide callbacks. A key can carry the same setting for a single application.
Team and key logging is part of Spanway Enterprise and needs a license that includes the scoped_integrations feature. Without it, adding a team callback with POST /team/{team_id}/callback, reading it with GET /team/{team_id}/callback, or setting logging in a key's or team's metadata answers 403 and names the feature. Removing a callback and POST /team/{team_id}/disable_logging stay open, so a team's logging can always be turned off after a license ends. Proxy admins and admins of the team can change it. Callback credentials are encrypted before they are stored, and request and response content is left out when turn_off_message_logging is on.
A real-world scenario
A company runs one gateway for the support team and the research team. Research keeps its traces in its own Langfuse project and does not want support engineers reading them. The platform admin attaches research's Langfuse keys to the research team. From then on every request made with a research key lands in research's project, support's requests do not, and the gateway's own spend logs and budgets keep working for both teams.
Add a team callback from the Admin UI
- Sign in as a proxy admin or an admin of the team and open Teams. Click the team to open its page, then the Settings tab, and click Edit.
- Under Logging Settings, in the Logging Integrations section, click Add Integration.
- Pick the integration in Select integration, for example Langfuse, and choose the Event Type (success, failure or both). Fill in the credentials the form shows for that integration. Type the real values. An
os.environ/NAMEreference is refused for team and key callbacks, because it would let a team read any variable of the gateway's environment. - Save the team. The Settings tab now lists the integration under Logging Settings with its secrets masked.
- Send one request with a key of that team and look for it in the team's project.
The team form has no way to switch off gateway wide callbacks for a team. Only a key can carry a disabled callbacks list (the Disabled Callbacks picker on the key form). The form is shown on every gateway, and on a gateway without the scoped_integrations feature saving a logging integration answers 403 naming the feature, while the team page's Logging block shows the enterprise notice.
Add a team callback with the API
curl -X POST http://localhost:4000/team/<team_id>/callback \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{
"callback_name": "langfuse",
"callback_type": "success_and_failure",
"callback_vars": {
"langfuse_public_key": "pk-...",
"langfuse_secret_key": "sk-...",
"langfuse_host": "https://cloud.langfuse.com"
}
}'
Expected result: a 200 with status: success and the team's id. GET /team/<team_id>/callback then returns the configuration with the secrets masked.
| Field | Meaning |
|---|---|
callback_name | Integration name, for example langfuse, langsmith or gcs_bucket. |
callback_type | success, failure or success_and_failure (default). |
callback_vars | Credentials and settings for the integration, such as langfuse_public_key, langfuse_secret_key, langfuse_host, langsmith_api_key, langsmith_project, gcs_bucket_name or gcs_path_service_account. |
Secret values in callback_vars are encrypted in the database. GET /team/{team_id}/callback returns the configuration with credentials masked, and audit log entries redact them too. Changing the host while keeping a stored secret is refused with a 400, the same rule as for gateway wide callbacks, so retype the secret with the new host.
Endpoints
{{ops:^/team/{team_id}/callback|^/team/{team_id}/disable_logging$}}
Disabling logging for a team
POST /team/{team_id}/disable_logging removes the team's own logging callbacks and deletes their stored credentials. It does not touch the gateway wide callbacks, which keep receiving the team's requests. Turning logging back on means registering the callbacks again with their credentials. The gateway still records usage and cost in its own spend logs so budgets keep working.
For a team handling sensitive content, turn on turn_off_message_logging or put the team under a zero data retention policy, which keep prompts and answers out of every destination, gateway wide ones included.
In the Admin UI:
- Open Teams, click the team and find its Logging block.
- Click Remove
next to one callback to delete only that one, or Disable all logging to remove every team callback. - Confirm in the dialog, which says the stored credentials are removed and must be registered again to re-enable logging.
curl -X POST http://localhost:4000/team/<team_id>/disable_logging \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Per-key and per-request destinations
A key can carry the same callback settings in its metadata.logging list, which lets a single application log to its own project. Clients can also pass Langfuse or LangSmith credentials in the request metadata for one call. Teams can only add destinations. A key can also skip gateway wide callbacks through a disabled callbacks list a proxy admin sets on it (metadata.spanway_disabled_callbacks, the Disabled Callbacks picker on the key form, licensed gateways only). Callers cannot turn callbacks off themselves: spanway_disabled_callbacks and no-log in a request body are dropped, and the x-spanway-disable-callbacks header is ignored unless an admin set spanway_settings.allow_dynamic_callback_disabling: true, see logging.
How it fits together
For a request, the gateway runs the global callbacks from spanway_settings, then the team's callbacks, then any key or request level callbacks. Each receives the full log entry described in logging. Dynamic credentials for Langfuse are also used by the Langfuse pass-through, so a team's SDK traces and gateway logs land in the same project.
Errors
| Status | Where | Meaning | Fix |
|---|---|---|---|
403 naming scoped_integrations | POST /team/{team_id}/callback, GET /team/{team_id}/callback, key or team metadata.logging | The license does not include the feature. | Add a license with scoped_integrations, or use a gateway wide callback. |
403 You do not have access to this team | Team callback routes | The caller is neither a proxy admin nor an admin of this team. | Ask a team admin or proxy admin to make the change. |
400 Team id = <id> does not exist. | POST /team/{team_id}/callback, as a proxy admin | No team has that id. Other callers get the 403 above instead, so team ids cannot be probed. | Check the id on the Teams page. |
404 Team id = <id> does not exist. Error removing team callback | DELETE /team/{team_id}/callback/{callback_name}, POST /team/{team_id}/disable_logging | No team has that id. | Check the id. |
404 callback_name = <name> is not registered for team_id = <id>. | DELETE /team/{team_id}/callback/{callback_name} | The team has no callback of that name. | List the team's callbacks with GET /team/{team_id}/callback. |
400 callback_name = <name> already exists in team_callback_settings, for team_id = <id> and event = <type> | POST /team/{team_id}/callback | The callback is already registered for that event. | Remove it first, or pick another event type. |
| 400 naming a span scope, capture or credential family conflict | POST /team/{team_id}/callback | The new settings contradict a callback the team already has, for example two Langfuse callbacks with different span scopes. | Make the settings match, or remove the other callback. |
422 Callback param '<name>' (from key/team callback metadata) contains an 'os.environ/' reference. ... | Saving a team or key with metadata.logging | A credential holds an os.environ/ reference, which team and key callbacks may not use. | Type the real value, or configure the callback gateway wide in the config file. |
| 400 naming a destination field and a secret field | Team callback routes and the Admin UI form | The host changed while the stored secret was kept. | Retype the secret together with the new host. |
500 No db connected or DB not connected. ... | Team callback routes | The gateway runs without a database, so teams cannot be stored. | Set DATABASE_URL. |
Audit
Every team callback change, POST /team/{team_id}/callback, a callback removal and POST /team/{team_id}/disable_logging, writes an updated row on Spanway_TeamTable with the team's metadata before and after, credentials replaced with REDACTED. Filter the audit log on Teams and the team id. The credentials themselves are stored encrypted in the team row's metadata.logging.
Logs
| Level | Line | Meaning |
|---|---|---|
| ERROR | Spanway.LoggingError: [Non-Blocking] Exception occurred while success logging ... | The team's destination rejected the event, often expired or mistyped credentials. The request was unaffected. |
| ERROR | Langfuse Layer Error - ... or Langsmith Error: <status> - <text> | The named platform refused the event. The text is the platform's answer, which usually names the key or project at fault. |
Related
- Logging for gateway wide callbacks and what is logged.
- Langfuse integration and LangSmith integration for the credentials each one takes.
- Teams for the team page in the Admin UI.
- Error reference and log reference.