how to turn off Heroku SQL logs from postgres

1.4k Views Asked by At

I'm running an application on Heroku that uses postgres.

All of my SQL statements are coming through in my logs; I'd like to turn this off.

They look like this:

Dec 03 05:41:36 ti-core app/postgres:  [1566-2] #011FROM alias  
Dec 03 05:41:36 ti-core app/postgres:  [1566-3] #011WHERE alias.nid = E'10.5334/sta.at' AND alias.namespace = E'doi'  
Dec 03 05:41:36 ti-core app/postgres:  [1566-4] #011 LIMIT 1

I can't figure out where I've set this level of heroku postgres debugging and where to turn it down a notch. Thanks!

2

There are 2 best solutions below

2
On

Presumably it comes from log_statement being set to all.

To reset it:

  • for the entire cluster: comment log_statement in postgresql.conf or set it to 'none'
  • for the database: ALTER DATABASE foo SET log_statement=default;
  • for a user: ALTER USER foo SET log_statement=default;

If that doesn't help, check log_min_duration_statement.

Relevant documentation chapter: Error Reporting and Logging.

0
On

I know this is probably not the right answer but I solved partially the problem with the following command (at least when I am reading logs in real time):

heroku logs --tail | grep -v 'Executing'

where the -v parameter inverts the grep search, so that only other log messages are shown (assuming they don't have the text 'Executing' in their content).

I hope this helps.