How to send logs from Heroku to Datadog

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



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


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

heroku drains:add --app=<HEROKU_APP_NAME> '<DATADOG_API_KEY>&ddsource=heroku&env=production&service=<HEROKU_APP_NAME>&host=<HEROKU_APP_NAME>'

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> '<DATADOG_API_KEY>?ddsource=heroku&service=<HEROKU_APP_NAME>&host=<HEROKU_APP_NAME>'

To see your log drain:

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


See Datadog’s Log Collection and Integrations.

Please support this site and join our Discord!