The first step is to ensure that you have access to all logs in real time. The Heroku client provides the heroku logs
command that allows you to view all logs collected by the Logplex in a unified manner. Using this command, you can filter through the postgres process to view only database logs. You can also use the -t
option (tail); this opens a continuous stream of data logs. Here is an example:
$ heroku logs -p postgres -t --app your-app-name 2014-11-01T23:41:42Z app[postgres.10]: [CHARCOAL] checkpoint complete: wrote 0 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.000 s, sync=0.000 s, total=0.004 s; sync files=0, longest=0.000 s, average=0.000 s
This way, you can view the logs generated by your Postgres database, perform the diagnosis, and identify the common errors.
The heroku logs command provides the following options to display the recent log output:
-n, --num NUM
: This refers to the number of lines to display-p, --ps PS
: This only...