Join us for our webinar on June 18th, 9:30am Pacific Time: Optimizing slow queries with EXPLAIN to fix bad query plans - register now.

Step 1: Add Log Drain

Log output support is only available on Heroku Postgres Standard, Premium and higher plans.

Log output for Heroku Postgres databases is sent to the application that the database is attached to, so we need to add a log drain to that application that forwards log lines to the pganalyze collector app running in your account.

The collector receives log drains at the following URL:


To check the [your-collector-app-domain-name] value of your collector app, run the following Heroku command:

heroku domains -a [your-collector-app-name]

It should look like 'your-collector-app-name-[unique identifier]'.

For the [ALIAS] value we recommend you use the add-on attachment name you've chosen in the initial setup, which you can determine by viewing the current Heroku configuration of your collector app:

heroku config -a [your-collector-app-name]
=== [your-collector-app-name] Config Vars
TESTAPP_URL: postgres://...:...@...:.../...

So in this case we would use TESTAPP_URL as our alias, and then we would add the log drain like this:

heroku drains:add https://[your-collector-app-domain-name] -a [your-app-name]

Make sure to replace [your-collector-app-name] with the name of your own collector application that you've deployed in your Heroku account, and [your-app-name] with the name of your main application (the one that owns the database for which you want to collect logs).

Continue to Step 2: Verify log drain

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →