Send data from Heroku to Axiom
This page explains how to send traces, logs, and metrics from Heroku Fir apps with telemetry drains, and logs from Heroku Cedar apps with log drains.
Heroku runs apps on two platform generations, and each generation has its own way to export data. For more information, see Heroku generations.
| Heroku generation | Method | Signals | Axiom edge deployments |
|---|---|---|---|
| Fir | Telemetry drains over OpenTelemetry (OTLP) | Traces, logs, and metrics | All |
| Cedar | Log drains | Logs | US East 1 (AWS) only |
Use the method that matches the generation of your app or space. Heroku supports telemetry drains only on Fir, and HTTPS log drains only on Cedar. For more information, see Log drains in the Heroku documentation.
Send telemetry from Fir apps
Use Heroku Telemetry Drains to send OpenTelemetry traces, logs, and metrics from Fir apps and spaces to Axiom. Heroku collects telemetry from the platform, such as router logs and dyno metrics, and OpenTelemetry signals that your app emits, and exports them in batches to each drain. For more information, see OpenTelemetry concepts and Heroku.
How telemetry drains map to Axiom datasets
Each telemetry drain has one endpoint, one set of headers, and a list of signals:
- With the default
httptransport, the drain exports OTLP over HTTP to the endpoint you specify as a base URL. Heroku appends the path for each signal, so traces go to/v1/traces, logs to/v1/logs, and metrics to/v1/metrics. Don’t add a path to the endpoint. - The headers apply to every signal that the drain sends.
Axiom stores each OpenTelemetry signal in its own dataset. Traces and logs each name their dataset in the X-Axiom-Dataset header, and metrics go to a metrics dataset named in the X-Axiom-Metrics-Dataset header. Because a drain sends the same X-Axiom-Dataset value with traces and logs, create one drain for each signal. Drains are additive, so all three drains receive telemetry from the same app or space.
Prerequisites
- Create an Axiom account.
- Create datasets in Axiom: one for traces and one for logs with the Events type, and one for metrics with the Metrics type. If you don’t send a signal, skip its dataset.
- Create an API token in Axiom with permissions to ingest data to these datasets.
- Download and install the Heroku CLI.
- Create a Fir-generation app or space on Heroku. For more information, see Heroku generations.
Add telemetry drains
To send telemetry from every app in a Fir space, replace --app HEROKU_APPLICATION_NAME with --space HEROKU_SPACE_NAME in each command. Space drains also apply to apps that you create in the space later.
To check the drains, run heroku telemetry --app HEROKU_APPLICATION_NAME. The output lists the ID of each drain. To see the configuration of one drain, run heroku telemetry:info DRAIN_ID.
After Heroku exports the first batch, you see traces, logs, and metrics in the Axiom datasets. To explore them, see Explore traces and Metrics.
Update or remove telemetry drains
To rotate the API token, update the headers of each drain:
The --headers value replaces all existing headers of the drain, so include the dataset header in every update. Heroku leaves the attributes that you don’t specify unchanged.
To remove a drain, run heroku telemetry:remove DRAIN_ID.
For more information about these commands, see Working with Heroku Telemetry Drains.
Send logs from Cedar apps
Use Heroku Log Drains to send logs from your Cedar apps to Axiom.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
- Create an account on Heroku.
- Download and install the Heroku CLI.
- Create a Heroku app.