Set up a Heroku log drain

Before you begin, you’ll need: Heroku CLI

Enable the runtime metrics

Optional - run the following command to include application run time metrics in your logs (for example, http status code, customer’s IP, and more):

heroku labs:enable log-runtime-metrics -a <<HEROKU-APP-NAME>>
Set up the log drain in Heroku CLI

Run this command in the command line.

heroku drains:add "https://<<LISTENER-HOST>>:8081?token=<<LOG-SHIPPING-TOKEN>>" -a <<HEROKU-APP-NAME>>

Replace <<LOG-SHIPPING-TOKEN>> with the token of the account you want to ship to.

Replace <<LISTENER-HOST>> with the host for your region. For example, if your account is hosted on AWS US East, or if hosted on Azure West Europe.

Replace <<HEROKU-APP-NAME>> with the name of the app in Heroku.

You can add custom fields to each log message, allowing you to identify different Heroku apps and filter your data in To do this, add &<<KEY>>=<<VALUE>> to the end of the URL.

For example:

heroku drains:add "https://<<LISTENER-HOST>>:8081?token=<<LOG-SHIPPING-TOKEN>>&<<KEY>>=<<VALUE>>" -a <<HEROKU-APP-NAME>>
Check for your logs

Give your logs some time to get from your system to ours, and then open Kibana to confirm you’re shipping logs.

If you still don’t see your logs, see log shipping troubleshooting.