Loading…
Loading…
Learn to use structured logs, payload traces, and correlation IDs to debug runtime requests. Search logs, analyze errors, and track asynchronous
The platform's logging and tracing capabilities provide deep visibility into every API request. When a consumer reports an error or unexpected behavior, these tools allow you to find the exact transaction and inspect its complete lifecycle.
Every runtime request generates a structured log entry. For failing requests, and for successful requests in debug mode, the platform also captures a full payload trace. All related events for a single transaction—from the initial API call to the backend response and final conversion—are linked by a unique correlation_id. This allows you to move from a high-level symptom, like an error at a specific time, to the precise request and response payloads that caused it.
This document details the structured logs, payload traces, and the APIs used to query them.
Each request processed by the runtime generates a structured log event containing key operational metrics and metadata. These logs are the primary source for searching and analyzing traffic patterns, performance, and errors.
The fields below are present in each structured log record.
| Field | Description |
|---|---|
occurred_at | The timestamp when the request was processed. |
correlation_id | A unique identifier for the entire transaction lifecycle. |
environment | The environment in which the request occurred. |
service_key | The key identifying the service that handled the request. |
operation_key | The key identifying the operation within the service. |
http_status | The HTTP status code returned to the API consumer. |
result_code | A platform-specific code classifying the outcome of the call. See Result Codes for details. |
latency_ms | The total time in milliseconds to process the request. |
request_size_bytes | The size of the inbound request payload in bytes. |
payload_logged | A boolean indicating if a full payload trace was captured for this call. |
| Field | Description |
|---|---|
backend_latency_ms | The time in milliseconds spent waiting for the backend system's response. |
converter_overhead_ms | The time spent in the platform's conversion logic, calculated as max(0, latency_ms − backend_latency_ms). |
response_size_bytes | The size of the final response payload in bytes. |
error_code | A specific code for an error condition. |
error_message | A human-readable message describing the error. |
The result_code provides a quick classification of the request's outcome. It is a key field for filtering and troubleshooting.
result_code | Meaning |
|---|---|
success | The call was processed and the payload was converted successfully. |
error | The call failed due to a validation error, transport issue, or a backend error. |
fault | The backend system returned a SOAP fault, which was mapped to a REST error response. |
fallback | A configured fallback was triggered due to a transport failure. The response to the consumer includes the X-S2R-Fallback: true header. |
contract_drift | The backend response's structure did not match the stored contract. This is also identified by error code S2R-RUN-0506. |
response_schema_violation | The backend response failed OpenAPI schema validation when response enforcement was enabled. This results in an HTTP 502 status and error code S2R-VAL-0430. |
You can search and filter structured logs using the Admin API.
GET /admin/v1/runtime-logs
This endpoint retrieves a paginated list of structured log entries. Results are paged on the server, allowing for efficient retrieval of large datasets.
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
environment | string | — | No | Filter by one or more environments. This parameter can be repeated. |
serviceKey | string | — | No | Filter by one or more service keys. This parameter can be repeated. |
operationKey | string | — | No | Filter by one or more operation keys. This parameter can be repeated. |
correlationId | string | — | No | Pinpoint a single transaction by its correlation ID. |
resultCode | string | — | No | Filter by result code (e.g., contract_drift). status is a supported alias for this parameter. |
window | string | — | No | A predefined time window to search. Values: 15m, 1h, 24h, 7d, 30d, 60d. Use start/end for a custom range. |
start | string | — | No | The start of a custom time range for the search. |
end | string | — | No | The end of a custom time range for the search. |
page | integer | — | No | The page number for paginated results. |
pageSize | integer | — | No | The number of results per page. |
To find all requests where the backend response did not match the expected contract, you can filter by resultCode.
GET /admin/v1/runtime-logs?resultCode=contract_drift
The live traffic view provides a drill-down layer for inspecting the full data of individual transactions. When a structured log indicates an issue, you can retrieve the corresponding payload trace to see the exact data that was processed.
A full trace includes:
To balance storage costs with debugging needs, payload capture follows a specific policy:
X-Debug-Enabled header for authorized callers).This policy ensures that you have complete diagnostic information for any failure while managing storage in normal operation. The platform handles all payload data as UTF-8, ensuring correct rendering of non-Latin character sets in traces.
The platform automatically detects when a backend response deviates from its expected contract (e.g., a field changes type, a required element is omitted). Instead of passing potentially malformed data to the API consumer, the platform flags the call with result_code=contract_drift and the error code S2R-RUN-0506.
The resulting error includes a driftReason field that specifies the path to the divergence. This allows API publishers to identify and address backend changes before they impact downstream consumers. You can search for these events directly using the runtime logs API: GET /admin/v1/runtime-logs?resultCode=contract_drift.
For asynchronous integrations that use callbacks, the platform tracks the full operation lifecycle. You can query the state of these executions via the GET /admin/v1/async-executions endpoint.
Tracked lifecycle information includes:
callbackReceivedAt and completedAt.status field that transitions through a defined lifecycle.The status of an asynchronous execution progresses through the following states:
stateDiagram-v2
[*] --> waiting_callback: Initial request
waiting_callback --> completed: Callback received & processed
waiting_callback --> failed: Callback processing failed
waiting_callback --> expired: Callback window elapses
failed --> waiting_callback: Reopened by operator
expired --> waiting_callback: Reopened by operatorOperators can manage stuck or failed asynchronous executions using several API endpoints, avoiding the need to wait for a new backend callback.
{id}/replay-preview): Test a stored callback against the current response mapping to see if a fix would work.{id}/reprocess): Re-apply the response mapping to a stored callback and persist the new result.{id}/callback-preview, {id}/callback-reprocess): Manually submit a callback payload for preview or for reprocessing and persistence.{id}/manual-complete, {id}/manual-fail): Manually force an execution into a completed or failed state.failed or expired state back to waiting_callback.To retrieve the complete payload chain for a specific transaction, use the debug traces API.
GET /admin/v1/debug-traces/{correlationId}: Returns the captured payload chain, including the inbound payload, generated SOAP request, backend SOAP response, and the final mapped REST response for a given correlationId.A companion endpoint provides metadata to help understand the context of a trace before replaying it:
GET /admin/v1/debug-traces/{correlationId}/replay-metadata: Returns runtime context like environment, service, operation, http_status, result_code, the active route hint (restMethod, restPath), and flags indicating which payloads were captured.NOTE
Backend Test Previews
Test runs initiated by operators through the onboarding and testing endpoints are stored as backend-test-previews and are accessible via GET /admin/v1/backend-test-previews. These are kept separate from live runtime traffic logs.
Use the result_code in structured logs to identify the nature of a failure:
error: A generic failure. Check error_code and error_message for details.fault: The backend returned a SOAP fault. The trace will contain the original fault from the backend.fallback: The request failed, but a configured fallback was successfully applied.contract_drift: The backend response structure has changed. See the driftReason in the trace.response_schema_violation: The backend response failed OpenAPI validation.S2R-RUN-0506: Indicates a Contract Drift. The backend's response did not match the stored contract.S2R-VAL-0430: Indicates a Response Schema Violation. The backend's response failed schema validation when enforce mode was active. This is accompanied by an HTTP 502 Bad Gateway status.