> ## 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.

# Modal

> Point Modal's built-in OpenTelemetry integration at Sazabi to stream the logs of every Modal Function in your workspace, with no code changes.

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

## About

Modal's [OpenTelemetry integration](https://modal.com/docs/guide/otel-integration) exports your workspace's logs to any backend that supports the OpenTelemetry HTTP API. Point it at your Sazabi intake URL and Modal pushes the logs of every Modal Function from its own servers. There is nothing to install, and no code, image, or deploy changes; the logs in Modal's dashboard are unchanged.

Modal's OpenTelemetry guide doesn't list the attributes on exported logs. For its [Datadog integration](https://modal.com/docs/guide/datadog-integration#log-attributes), Modal documents `container_id`, `app_id`, `app_name`, `function_id`, `function_name`, `function_call_id`, `input_id`, `sandbox_id`, `environment`, `workspace`, and `workspace_id`. Sazabi keeps whatever resource and log attributes Modal sends.

Modal also exports [audit logs](https://modal.com/docs/guide/audit-logs) through the same integration on the Enterprise plan, where audit logs are available.

> [!NOTE]
>
> **Sandboxes.** Modal's OpenTelemetry guide lists Function logs and audit logs and doesn't say whether Sandbox logs are exported. The log attributes Modal documents for Datadog include `sandbox_id`, which suggests Sandbox entrypoint logs are forwarded too, but Modal doesn't confirm it. Output of commands run with `Sandbox.exec()` is [not part of a Sandbox's logs](https://modal.com/docs/reference/modal.Sandbox#logs), so it isn't exported; log it from the code that calls `exec()`.
>
> **Plans.** Modal's OpenTelemetry guide doesn't restrict the integration to a plan, and the [pricing page](https://modal.com/pricing) doesn't list it as a paid feature. Audit logs are Enterprise-only. Custom metrics and spans are a beta Modal enables on request.

## Prerequisites

* A Modal workspace, and permission to create Secrets and edit the workspace's metrics settings
* Your Sazabi intake URL, shown above — open the log source and copy the **Intake URL** from its setup screen (the public key is embedded in the URL)

## Set up in the dashboard

**Step 1**

### Create the Modal Secret

Modal sends the auth header from a Modal Secret: each key named `OTEL_HEADER_<name>` becomes the HTTP header `<name>`. In the Modal dashboard, open [Secrets](https://modal.com/secrets) and create a new Secret from the **OpenTelemetry** template. Name it `sazabi-otel` and give it exactly one key, removing any others the template pre-fills:

| Key | Value |
| - | - |
| `OTEL_HEADER_Authorization` | `Bearer <your public key>` |

The setup screen above shows the value with your public key filled in.

**Step 2**

### Point the integration at Sazabi

Open Modal's [metrics settings](https://modal.com/settings/metrics). Set the OpenTelemetry push URL to your intake URL exactly as shown, with no `/v1/logs` path (Modal wants the base URL and adds the path itself), and choose the `sazabi-otel` Secret. Save your changes.

**Step 3**

### Send a test log

Click the integration's test button. Modal sends a `Hello from Modal! 🚀` log from the `modal.test_logs` service.

## Set up with the CLI

You can also register the Modal 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 modal --mode manual
```

The command prints the intake URL for the new source. Use it as Modal's push URL; the Secret value is `Bearer sazabi_public_` followed by the first label of the URL's hostname. 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. The Modal dashboard steps above are still needed.

## Verify

Open the [Intake page](https://docs.sazabi.com/guides/instrument/intake.md) in the Sazabi dashboard and confirm the `Hello from Modal! 🚀` test log from the **Modal** source appears within a minute or two. Then run any Modal Function and search for its output.

## Troubleshooting

**The test log doesn't arrive** — Check that the push URL is the intake URL exactly, with no `/v1/logs` suffix, and that the Secret's key is `OTEL_HEADER_Authorization` with the value `Bearer <your public key>`.

**Function logs don't arrive but the test log did** — Modal exports logs produced after the integration was saved; older logs aren't backfilled. Run the Function again.

**Metric data points appear as log lines** — Modal also pushes [container metrics](https://modal.com/docs/guide/otel-integration#metrics) to the same URL. Sazabi stores those data points as plain log lines, not as metrics.

**Sandbox command output is missing** — Output of `Sandbox.exec()` commands isn't part of a Sandbox's logs, so Modal doesn't export it. Log it from the code that calls `exec()`.

## Further reading

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

> [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.