How to send logs from Heroku to Datadog


This article goes over how to send logs from Heroku Logplex to Datadog over HTTP.

Prerequisites

Datadog

Copy your Datadog API key. It should look something like:

67890abcedf01234567890abcdef0123

Add an HTTPS log drain so Heroku Logplex sends a POST request to Datadog:

heroku drains:add --app=<HEROKU_APP_NAME> 'https://http-intake.logs.datadoghq.com/api/v2/logs?dd-api-key=<DATADOG_API_KEY>&ddsource=heroku&env=production&service=<HEROKU_APP_NAME>&host=<HEROKU_APP_NAME>.herokuapp.com'

Replace <HEROKU_APP_NAME> with your Heroku app name and <DATADOG_API_KEY> with your Datadog API key.

If you’re still using the deprecated v1 endpoint:

heroku drains:add --app=<HEROKU_APP_NAME> 'https://http-intake.logs.datadoghq.com/v1/input/<DATADOG_API_KEY>?ddsource=heroku&service=<HEROKU_APP_NAME>&host=<HEROKU_APP_NAME>.herokuapp.com'

To see your log drain:

heroku drains --app=<HEROKU_APP_NAME> # --json

Resources

See Datadog’s Log Collection and Integrations.



Please support this site and join our Discord!