Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.baseten.co/llms.txt

Use this file to discover all available pages before exploring further.

When a model is serving hundreds of requests per minute, a single slow or failing prediction can be difficult to isolate from the surrounding noise. Baseten addresses this by assigning a unique request ID to every predict call and returning it in the X-Baseten-Request-Id response header. Because each request carries its own ID, you can trace a single prediction through your model’s logs without sifting through unrelated entries.
Per-request log filtering requires Truss version 0.15.5 or later. Upgrade with pip install --upgrade truss

Scope by environment or deployment

The Logs tab can show entries from a single deployment or from every deployment in an environment. Use the dropdowns at the top of the tab to switch. Environment scope aggregates logs across every deployment in that environment, including past deployments still serving traffic during a rollout. Use it to follow a request across deployment boundaries or to watch a promotion in progress. Deployment scope restricts logs to a single deployment ID. Use it to isolate behavior to one version, such as a development deployment. The same scope applies to live tail and historical search.

Getting the request ID

The first step is capturing the request ID from the response. Baseten includes it in every predict response, regardless of whether the call is synchronous, asynchronous, or gRPC. The exact location depends on the protocol you’re using:
When you make a predict call, include the -sD- flag to print response headers alongside the body:
curl -sD- -X POST "https://model-{MODEL_ID}.api.baseten.co/production/predict" \
  -H "Authorization: Bearer $BASETEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Hello"}'
The request ID appears as a response header:
X-Baseten-Request-Id: 31255019cf83c4d0c7492a5006591e1f502a5

Filtering logs by request ID

Once you have a request ID, open the model’s logs page and enter it in the search filter bar using the requestId: prefix:
requestId:31255019cf83c4d0c7492a5006591e1f502a5
The view narrows to show only log entries from that request. Each log line also displays the request ID alongside the replica ID, so you can confirm you’re looking at the right trace even when scrolling through mixed output.

Logging with request context

For standard Truss models, Baseten automatically attaches the request ID to any log emitted via Python’s logging module during a predict call. No configuration is required — just use a logger:
import logging

logger = logging.getLogger(__name__)

class Model:
    def predict(self, request):
        logger.info("Starting prediction")  # request_id is added automatically
        ...

Custom servers

For standard Truss models, Baseten handles request ID logging automatically through the framework’s built-in JSON formatter. No configuration is required. Custom servers don’t have this built-in support, so you’ll need to do two things: extract the x-baseten-request-id header from incoming requests, and include it as a top-level request_id key in your JSON log output. Both steps are covered in the setup guides for custom HTTP servers and custom gRPC servers.

Export logs to an OTLP endpoint

You can stream the same logs that appear in the Baseten UI to any backend that accepts OTLP over HTTP, including Honeycomb, Datadog, and Grafana Cloud. Once configured, every new log line is forwarded to your endpoint in near real time, so you can build dashboards, alerts, and long-term retention on top of your inference traffic without scraping the UI.
Log export is rolling out gradually. If the OTEL connection card isn’t visible in your settings, contact Baseten support to enable it for your organization.

What gets exported

The exporter forwards every log you would see in the Baseten UI, which includes:
  • Build logs: image builds for new deployments.
  • Deploy and promotion logs: lifecycle events emitted as a deployment activates, scales, or is promoted to an environment.
  • Serving logs: stdout and stderr from your model replicas, including anything you write through Python’s logging module.
Each record is sent as an OTLP LogRecord with service.name = "baseten" and an allowlisted set of attributes:
AttributeDescription
messageThe log line.
model_idStable ID of the model the log came from.
model_version_idDeployment (model version) the log came from.
environmentEnvironment name, such as production or staging, when the deployment is attached to one.
replicaReplica ID for serving logs.
request_idPer-prediction request ID. Matches the X-Baseten-Request-Id header.
training_job_idTraining job ID for training logs.
chainlet_idChainlet ID for Chains.
exc_infoFormatted Python traceback, when the log carries an exception.
Severity is mapped from the original log level to OTLP SeverityNumber and SeverityText (DEBUG, INFO, WARN, ERROR, FATAL). Internal labels that aren’t on the allowlist are stripped before export so your backend only receives the same fields you see in the UI. Exports start from the moment the connection is enabled. Historical logs are not backfilled, and delivery is best-effort: Baseten retries transient failures with exponential backoff, but records can be dropped if your endpoint is unreachable for an extended period.

Configure a connection

Each Baseten organization can have one OTLP destination at a time.
1

Open settings

Go to Settings → General and find the OTEL connection card.
2

Add a connection

Click Add connection and fill in:
  • Endpoint URL: The full URL of your OTLP/HTTP logs receiver, including the path (typically /v1/logs). See the integration notes below for per-vendor examples.
  • Header name: The HTTP header your backend uses to authenticate.
  • Header value: The credential for that header. The value is stored encrypted and never displayed again after you save it.
3

Save and verify

Save the connection. New log records start flowing to your endpoint within a few seconds. Click Test on the saved connection to send a probe log and confirm the endpoint and credentials are accepted. For an end-to-end check, send a prediction to a deployment and look for its request ID in your backend.
To rotate credentials or change destinations, use the edit icon on the saved connection. Removing the connection stops exports immediately.

Integration notes

The endpoint and header values below come from each vendor’s OTLP/HTTP documentation. Check those docs for the most current values for your account and region.
Honeycomb accepts OTLP/HTTP at https://api.honeycomb.io/v1/logs (or a region-specific host such as https://api.eu1.honeycomb.io/v1/logs). Authenticate with an ingest API key:
  • Endpoint URL: https://api.honeycomb.io/v1/logs
  • Header name: x-honeycomb-team
  • Header value: Your Honeycomb ingest API key.
On Honeycomb environments that route by service.name, logs land in a dataset named baseten. Honeycomb Classic accounts and other dataset-routing setups may differ. See Honeycomb’s OTLP/HTTP reference for dataset routing and regional endpoints.
Other OTLP/HTTP collectors work the same way. If your backend isn’t listed, fill in the endpoint URL and the auth header (name and value) it documents for OTLP and Baseten will start sending logs to it.