Sazabi
Log sourcesSend to an endpoint

Porter

Add OpenTelemetry environment variables to your Porter service and initialize the SDK to send application logs and traces directly to Sazabi.

About

Forward your Porter application logs and traces into Sazabi. Porter has no platform log drain, so you instrument your application with the OpenTelemetry SDK and point it at a Sazabi endpoint. Your app then sends logs and traces straight to Sazabi from your Porter deployments.

Porter's injected PORTER_* variables add service and deployment metadata automatically when you include them in OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES.

Prerequisites

  • A service deployed on Porter.
  • Your Sazabi intake URL (shown above).

Set up in the dashboard

Set environment variables

Add these variables in the Porter service Variables page. OTEL_EXPORTER_OTLP_ENDPOINT is your intake URL (shown above). Porter fills in the $PORTER_* references from its own service and deployment metadata at runtime.

OTEL_EXPORTER_OTLP_ENDPOINT=<your intake URL>
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_SERVICE_NAME=$PORTER_APP_SERVICE_NAME
OTEL_RESOURCE_ATTRIBUTES=service.version=$PORTER_IMAGE_TAG,porter.revision=$PORTER_POD_REVISION,porter.pod.name=$PORTER_POD_NAME

You can also put shared values in a Porter environment group.

Install the OpenTelemetry SDK

Install the OpenTelemetry packages for your runtime if your app does not already initialize OpenTelemetry.

Node.js

bun add @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node @opentelemetry/exporter-trace-otlp-proto @opentelemetry/exporter-logs-otlp-proto @opentelemetry/sdk-logs

Python

pip install opentelemetry-distro opentelemetry-exporter-otlp-proto-http
opentelemetry-bootstrap -a install

# Porter start command example:
opentelemetry-instrument python app.py

For other runtimes, initialize OpenTelemetry before the app handles requests, or run an OpenTelemetry Collector, Vector, or Fluent Bit service in Porter.

Add the Node.js instrumentation file

For Node.js, create an instrumentation.cjs file that wires up both the trace and log exporters. Load it from your start command only — for example NODE_OPTIONS='--require ./instrumentation.cjs' node server.js.

Do not set NODE_OPTIONS as a global environment variable. It applies during build and install, where the relative --require path resolves from inside node_modules/ and can break dependency postinstall scripts. If your platform forces an env var, use an absolute path such as --require /workspace/instrumentation.cjs.

// instrumentation.cjs
const { NodeSDK } = require("@opentelemetry/sdk-node");
const {
  getNodeAutoInstrumentations,
} = require("@opentelemetry/auto-instrumentations-node");
const {
  OTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-proto");
const { OTLPLogExporter } = require("@opentelemetry/exporter-logs-otlp-proto");
const { BatchLogRecordProcessor } = require("@opentelemetry/sdk-logs");

try {
  const sdk = new NodeSDK({
    traceExporter: new OTLPTraceExporter(),
    logRecordProcessors: [new BatchLogRecordProcessor(new OTLPLogExporter())],
    instrumentations: [getNodeAutoInstrumentations()],
  });
  sdk.start();
  process.on("SIGTERM", () => {
    void sdk.shutdown();
  });
} catch (err) {
  console.error("OpenTelemetry initialization failed", err);
}

@opentelemetry/auto-instrumentations-node/register configures traces only, so the log exporter requires an explicit BatchLogRecordProcessor. Without it, logs silently do not flow. Use the .cjs extension so the file loads as CommonJS even when your app's package.json sets "type": "module".

Redeploy the service

Redeploy the Porter service so it picks up the new environment variables and instrumentation file.

Set up with the CLI

You can also register the Porter log source with the Sazabi CLI (installed and authenticated — see CLI reference).

Registering the source mints the same intake URL the dashboard shows above (the public key is embedded in its hostname):

sazabi log-sources create porter --mode connectionless

The command prints the intake URL for the new source — copy the whole URL and point your sender at it using the configuration shown above. Run sazabi log-sources get <log-source-id> at any time to reprint the endpoint, or sazabi log-sources list to see every log source in the project.

Verify

Generate a request or test log line from your Porter service. Open the Intake page in the Sazabi dashboard and confirm logs or traces from the Porter source appear. Records typically arrive within a minute or two of the request.

Troubleshooting

No telemetry appears — Check the Porter deployment logs for OpenTelemetry exporter errors. Confirm OTEL_EXPORTER_OTLP_ENDPOINT is set on the service, not only at build time.

Traces appear but logs do notauto-instrumentations-node/register sets up traces only. Ensure your instrumentation.cjs also initializes the BatchLogRecordProcessor with OTLPLogExporter.

Metrics are not stored — Sazabi does not store OpenTelemetry metrics sent to this endpoint. Point your metrics exporter at the OpenTelemetry Metrics source instead.

Further reading