---
title: "Heroku"
description: "Learn how to set up Heroku drains to forward logs and traces data to Sentry."
url: https://docs.sentry.io/product/drains/heroku/
last_updated: 2026-12-03T22:37:16.000Z
---

# Heroku Drains | Sentry Docs

Heroku drains let you forward logs and traces from applications running on Heroku to Sentry without changing your application code. Which data you can send depends on your app's [generation](https://devcenter.heroku.com/articles/generations).

| Generation                                                       | Drain type                                                                                     | Logs | Traces |
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---- | ------ |
| [Fir](https://devcenter.heroku.com/articles/generations#fir)     | [Telemetry drain (OTLP)](https://docs.sentry.io/product/drains/heroku.md#fir-telemetry-drains) | ✅    | ✅      |
| [Cedar](https://devcenter.heroku.com/articles/generations#cedar) | [Log drain (Logplex)](https://docs.sentry.io/product/drains/heroku.md#cedar-log-drains)        | ✅    | ❌      |

Sending metrics is not supported yet.

## [Prerequisites](https://docs.sentry.io/product/drains/heroku.md#prerequisites)

Before you begin, ensure you have:

* A Heroku app that you want to monitor
* A Sentry project you want to send data to

## [Fir Telemetry Drains](https://docs.sentry.io/product/drains/heroku.md#fir-telemetry-drains)

Heroku Telemetry supports [exporting OpenTelemetry (OTEL)-compliant data](https://devcenter.heroku.com/articles/heroku-telemetry) to send logs and traces to Sentry. Telemetry drains are only available to Fir-generation apps and spaces.

### [Adding a Telemetry Drain](https://docs.sentry.io/product/drains/heroku.md#adding-a-telemetry-drain)

To add a telemetry drain to an app or space, use the `heroku telemetry:add` command. For more details, see the [Heroku Telemetry documentation](https://devcenter.heroku.com/articles/working-with-heroku-telemetry-drains#add-a-telemetry-drain).

When using the `heroku telemetry:add` command, you'll need to provide your Sentry project's OTLP endpoint URL and a `x-sentry-auth` header with the public key. You can find both in your Sentry Project Settings under [**Client Keys (DSN)**](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/:projectId/keys/) > **OpenTelemetry (OTLP)**. The same URL is also listed under **Heroku Drains**.

```bash
heroku telemetry:add https://o<orgId>.ingest.sentry.io/api/<projectId>/integration/otlp --app myapp --signals logs,traces --transport http --headers '{"x-sentry-auth":"sentry sentry_key=<your-public-key>"}'
```

To add a telemetry drain to the entire space:

```bash
heroku telemetry:add https://o<orgId>.ingest.sentry.io/api/<projectId>/integration/otlp --space myspace --signals logs,traces --headers '{"x-sentry-auth":"sentry sentry_key=<your-public-key>"}'
```

You can use the `--signals` flag to specify the signals you want to send to Sentry. Only `logs` and `traces` are supported.

Sentry only supports the `http` `--transport` flag.

## [Cedar Log Drains](https://docs.sentry.io/product/drains/heroku.md#cedar-log-drains)

Cedar-generation apps can forward their logs to Sentry with a [Heroku HTTPS log drain](https://devcenter.heroku.com/articles/log-drains#https-drains). Logplex sends your application's output, along with logs from the Heroku router and platform, to Sentry as [logs](https://docs.sentry.io/product/logs.md). Log drains don't carry traces or metrics.

### [Adding a Log Drain](https://docs.sentry.io/product/drains/heroku.md#adding-a-log-drain)

To set up a log drain, follow these steps. Heroku log drains can't send custom headers, so the public key goes in the `sentry_key` query parameter of the drain URL.

1. Copy the Heroku Log Drain URL from your Sentry Project Settings under [**Client Keys (DSN)**](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/:projectId/keys/) > **Heroku Drains**.

```bash
https://o<orgId>.ingest.sentry.io/api/<your-project-id>/integration/heroku/logs?sentry_key=<your-public-key>
```

2. Add the drain to your app with the `heroku drains:add` command. Keep the quotes around the URL so your shell doesn't interpret the `?`.

```bash
heroku drains:add "https://o<orgId>.ingest.sentry.io/api/<your-project-id>/integration/heroku/logs?sentry_key=<your-public-key>" -a myapp
```

3. To check that the drain was added, run `heroku drains -a myapp`.

Then you should get logs in your Sentry project.

### [Log Attributes](https://docs.sentry.io/product/drains/heroku.md#log-attributes)

Sentry parses each Logplex message and adds these attributes, which can be used for filtering and grouping in [Explore](https://docs.sentry.io/product/explore.md). For full attribute definitions, see the [Heroku attributes in Sentry Conventions](https://conventions.sentry.dev/attributes/heroku/).

| Attribute                    | Description                                                                                                               |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `cloud.provider`             | Always `heroku`.                                                                                                          |
| `origin`                     | Always `auto.log_drain.heroku`.                                                                                           |
| `heroku.source`              | Where the log came from: `app` for your application's output, `heroku` for logs from the Heroku platform.                 |
| `heroku.dyno.name`           | The dyno that emitted the log or that served the request, such as `web.1`. Not set for platform components such as `api`. |
| `heroku.logplex.drain_token` | The token of the log drain that delivered the log.                                                                        |
| `heroku.error.code`          | The [Heroku error code](https://devcenter.heroku.com/articles/error-codes), such as `H12` or `R14`.                       |
| `heroku.error.description`   | The description of the error code, such as `Request timeout`.                                                             |

Heroku platform logs that report an error code, such as `Error R14 (Memory quota exceeded)`, are stored with the `error` log level.

#### [Router Logs](https://docs.sentry.io/product/drains/heroku.md#router-logs)

For [Heroku router logs](https://devcenter.heroku.com/articles/http-routing#heroku-router-log-format), Sentry also extracts the request fields. The log level follows the router's `at` field.

| Attribute                   | Router field  | Description                                                |
| --------------------------- | ------------- | ---------------------------------------------------------- |
| `http.request.method`       | `method`      | The HTTP request method.                                   |
| `url.path`                  | `path`        | The request path, without the query string.                |
| `url.query`                 | `path`        | The query string of the request, if any.                   |
| `url.scheme`                | `tls`         | `https` or `http`.                                         |
| `server.address`            | `host`        | The requested host.                                        |
| `server.port`               | `host`        | The requested port, if the host includes one.              |
| `client.address`            | `fwd`         | The client IP address the Heroku router appended to `fwd`. |
| `http.response.status_code` | `status`      | The HTTP response status code.                             |
| `network.protocol.name`     | `protocol`    | Always `http`.                                             |
| `network.protocol.version`  | `protocol`    | The HTTP version, such as `1.1` or `2`.                    |
| `tls.protocol.name`         | `tls_version` | Always `tls`.                                              |
| `tls.protocol.version`      | `tls_version` | The TLS version, such as `1.3`.                            |
| `heroku.router.request_id`  | `request_id`  | The Heroku request ID.                                     |
| `heroku.router.connect`     | `connect`     | Time in milliseconds to connect to the dyno.               |
| `heroku.router.service`     | `service`     | Time in milliseconds the dyno took to process the request. |
| `heroku.dyno.name`          | `dyno`        | The dyno that served the request.                          |
| `heroku.error.code`         | `code`        | The Heroku error code, such as `H12`.                      |
| `heroku.error.description`  | `desc`        | The description of the error code.                         |

### [Search and Alert on Heroku Errors](https://docs.sentry.io/product/drains/heroku.md#search-and-alert-on-heroku-errors)

Use `heroku.error.code` to find platform errors in the [Logs](https://docs.sentry.io/product/logs.md) explorer. For example:

* `heroku.error.code:H12`: Request timeouts
* `heroku.error.code:R14`: Dynos that exceeded their memory quota
* `heroku.error.code:H*`: All H-series (HTTP) errors
* `heroku.source:heroku heroku.dyno.name:web.1`: All platform logs for one dyno

To get notified when these errors happen, run the search and use **Save as** to create a [monitor](https://docs.sentry.io/product/monitors-and-alerts/monitors.md). See [Save Log Queries](https://docs.sentry.io/product/logs.md#save-log-queries).

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
