Heroku integration

Start logging in 2 minutes

1. Create a telemetry source

Create a new Heroku source in Better Stack. We recommend having separate telemetry sources for each of your applications in Heroku.

2. Install

Install the Heroku CLI.

3. Log in

Log in to Heroku:

Run Heroku Login
heroku login

4. Set up

Set up Better Stack drain to Heroku:

Add Heroku drain
heroku drains:add \
    "https://$INGESTING_HOST_VEC:6515/events?source_token=$SOURCE_TOKEN" \
    -a $HEROKU_APP_SLUG


Insert your Heroku details

You will need to replace $HEROKU_APP_SLUG in the command above. The application slug is the name of the application in Heroku. You can see your available apps in the Heroku dashboard.

Running a Heroku Fir app?

Heroku's next-generation Fir uses OpenTelemetry drains instead of the Logplex drains used in Cedar. Follow Send telemetry from Heroku Fir apps to send logs, metrics, and traces to Better Stack in Fir.

5. Start logging

You should see your logs in Better Stack β†’ Live tail.

Check out your metrics in the Heroku dashboard.

Enable metrics in Cedar

Enable Heroku Runtime Metrics to take full advantage of our Heroku dashboard.

Use Heroku CLI to set up metrics for your app:

Enable Heroku metrics
heroku labs:enable log-runtime-metrics --app $HEROKU_APP_SLUG
heroku restart --app $HEROKU_APP_SLUG

Insert your Heroku details

You will need to replace $HEROKU_APP_SLUG in the commands above. The application slug is the name of the application in Heroku. You can see your available apps in the Heroku dashboard.

Send telemetry from Heroku Fir apps

Send logs, metrics, and traces to Better Stack using an OpenTelemetry drain in Heroku Fir.

1. Create a Heroku source

Create a Heroku source in Better Stack.

2. Add the telemetry drain

Send your Fir app's telemetry to the source:

Add Heroku telemetry drain
heroku telemetry:add "https://$INGESTING_HOST" \
    --app $HEROKU_APP_SLUG \
    --transport http \
    --signals logs,metrics,traces \
    --headers '{"Authorization": "Bearer $SOURCE_TOKEN"}'


Insert your Heroku details

Replace $HEROKU_APP_SLUG with your application slug. It is the name of the application in Heroku, listed in the Heroku dashboard.

Send telemetry from a whole Fir Private Space

Add the drain to the space instead of running the app command above. Every app in the space sends its telemetry to Better Stack, including apps you create later:

Add Heroku space telemetry drain
heroku telemetry:add "https://$INGESTING_HOST" \
    --space $HEROKU_SPACE \
    --transport http \
    --signals logs,metrics,traces \
    --headers '{"Authorization": "Bearer $SOURCE_TOKEN"}'


Replace $HEROKU_SPACE with the name of your space. Run heroku spaces to list your spaces.

3. View your data

You should see your logs and traces in Better Stack β†’ Live tail.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! πŸ™

Additional resources

Interested in best practices for logging in Heroku? Check out our Complete Guide to Logging in Heroku.