> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sazabi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sentry SDK

> Point your Sentry SDK at a Sazabi DSN to forward errors, structured logs, and envelope telemetry — either replacing your Sentry project DSN or sending to both.

[All Sentry integration capabilities](https://docs.sazabi.com/catalogs/integrations/sentry)

## About

Forward errors, exceptions, structured logs, and other envelope telemetry from any Sentry SDK into Sazabi. Point your Sentry SDK at a Sazabi DSN — either replacing your Sentry project DSN to send events only to Sazabi, or using the SDK's built-in multiplexed transport to send to both Sazabi and your existing Sentry project so its dashboards and alerting stay intact. Performance transactions and standalone spans that reach the Sazabi DSN are also ingested; spans inside a transaction are kept on that transaction's record.

> [!NOTE]
>
> Which Sentry setup do you need? For each error and exception, with stack traces and structured logs, use this Sentry SDK setup. You can keep sending to Sentry at the same time. With Python, sending to both copies only error events to Sazabi. For Sentry issue status changes, comments, and alert-rule events, use the Sentry integration: [connect your account](https://docs.sazabi.com/catalogs/log-sources/connect-your-account/sentry.md) or [set it up yourself](https://docs.sazabi.com/catalogs/log-sources/send-to-an-endpoint/sentry.md). The integration does not send every error occurrence. You can set up both.

Sentry also has a **platform integration** path that streams Sentry issue, comment, and alert events through a Sentry Internal Integration webhook. See [Sentry page](https://docs.sazabi.com/catalogs/log-sources/send-to-an-endpoint/sentry.md) for that setup. The connect-your-account path at [/catalogs/log-sources/connect-your-account/sentry](https://docs.sazabi.com/catalogs/log-sources/connect-your-account/sentry.md) sets up that same platform integration automatically.

## Prerequisites

* A Sentry SDK already initialized in your application.
* Your Sazabi DSN: `https://sazabi@your-intake-host/0` (your intake URL is shown above — replace `your-intake-host` with the hostname).

## Set up in the dashboard

**Step 1**

### Choose JavaScript/Node.js or Python

**JavaScript / Node.js: Send only to Sazabi**

Replace your Sentry project DSN with the Sazabi DSN. Your existing Sentry project no longer receives these events.

```javascript theme={"system"}
import * as Sentry from "@sentry/node";

Sentry.init({
  dsn: "https://sazabi@your-intake-host/0",
  enableLogs: true,
});
```

**JavaScript / Node.js: Multiplex (send to both)**

Keep your existing Sentry project receiving events and also stream to Sazabi via the SDK's built-in `makeMultiplexedTransport`.

```javascript theme={"system"}
import * as Sentry from "@sentry/node";
import { makeMultiplexedTransport } from "@sentry/core";

const SENTRY_DSN = "<your-existing-sentry-dsn>";
const SAZABI_DSN = "https://sazabi@your-intake-host/0";

Sentry.init({
  // Primary DSN keeps your Sentry project (and its alerting) working.
  dsn: SENTRY_DSN,
  enableLogs: true,
  transport: makeMultiplexedTransport(
    Sentry.makeNodeTransport,
    // Fan every event out to both destinations.
    () => [{ dsn: SENTRY_DSN }, { dsn: SAZABI_DSN }],
  ),
});
```

In the browser, import `makeFetchTransport` from `@sentry/browser` and pass it in place of `Sentry.makeNodeTransport`.

**Python: Send only to Sazabi**

```python theme={"system"}
import sentry_sdk

sentry_sdk.init(
    dsn="https://sazabi@your-intake-host/0",
    enable_logs=True,
)
```

**Python: Multiplex (send to both)**

The Python SDK has no built-in multiplexed transport. Use a second `Client` plus a `before_send` hook to forward a copy of each event to Sazabi; returning `event` keeps your primary Sentry project receiving it.

```python theme={"system"}
import sentry_sdk
from sentry_sdk import Client

SENTRY_DSN = "<your-existing-sentry-dsn>"
SAZABI_DSN = "https://sazabi@your-intake-host/0"

# Secondary client streams a copy of every event to Sazabi.
_sazabi = Client(dsn=SAZABI_DSN)

def _forward_to_sazabi(event, hint):
    _sazabi.capture_event(event, hint=hint)
    return event  # keep sending to your primary Sentry project

# Primary init keeps your Sentry project (and its alerting) working.
sentry_sdk.init(
    dsn=SENTRY_DSN,
    enable_logs=True,
    before_send=_forward_to_sazabi,
)
```

> [!WARNING]
>
> The Python `before_send` hook forwards error events only — structured logs
> stay on your primary Sentry project on this path. Verify Sazabi delivery with
> a test exception.

The Sazabi DSN also works with other official Sentry SDKs including Go, Ruby, Java, and .NET.

**Step 2**

### Enable structured logs

To capture structured logs in addition to errors, enable logging in your SDK:

* JavaScript: `enableLogs: true` in `Sentry.init`
* Python: `enable_logs=True` in `sentry_sdk.init`

**Step 3**

### Hand off the change

Commit these changes on a new branch, push it, and open a pull request. Keep the intake URL and any keys in environment variables or a secret store, and commit only configuration that references them.

## Set up with the CLI

You can also register the Sentry SDK log source with the [Sazabi CLI](https://docs.sazabi.com/reference/cli.md) (installed and authenticated — see [CLI reference](https://docs.sazabi.com/reference/cli/log-sources.md)).

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

```bash theme={"system"}
sazabi log-sources create sentry --mode manual
```

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

Restart the application, then throw a test exception and write a structured log. Open the [Intake page](https://docs.sazabi.com/guides/instrument/intake.md) in the Sazabi dashboard and confirm error events from the **Sentry SDK** source appear. Records typically arrive within a minute or two.

## Troubleshooting

**Events do not appear** — Confirm the DSN hostname in your `Sentry.init` call matches your intake URL. The DSN format is `https://sazabi@<intake-host>/0`.

**Errors appear in Sentry but not in Sazabi** — Check that you set up this Sentry SDK path, not only the Sentry integration. The integration sends events about Sentry issues, not every error occurrence.

**Browser events blocked** — If your site sets a Content Security Policy, add your intake host (`*.intake.sazabi.com`) to `connect-src`. If you use Sentry's `tunnel` option, events go to your tunnel endpoint instead of the DSN host, so they reach Sazabi only if your tunnel forwards them.

**Only some events arrive** — `sampleRate` and `beforeSend` run before events are sent, so events they drop never reach Sazabi.

**Structured logs appear in Sentry but not in Sazabi (Python multiplex path)** — On the Python `before_send` path, only error events are forwarded. Structured logs stay on your primary Sentry project. Verify with a test exception.

**Attachments, profiles, or replay recordings are absent** — Sazabi does not store binary attachments, profiles, replay recordings, or native crash blobs as logs.

## Further reading

> [card] [Intake](https://docs.sazabi.com/guides/instrument/intake.md)
>
> See per-source ingestion volume and health in the Intake page.

> [card] [Connect your Sentry account](https://docs.sazabi.com/catalogs/log-sources/connect-your-account/sentry.md)
>
> Let Sazabi provision the Sentry Internal Integration automatically.

> [card] [Log sources](https://docs.sazabi.com/catalogs/log-sources.md)
>
> Browse the full log source catalog.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.