Postgre SQL Logging

If you're dealing with recalcitrant black-box software, it sometimes helps to look at the database queries being made to figure out how (and why!) it does things. Here's how to enable query logging.

Edit postgresql.conf (sometimes found in /var/lib/pgsql/data) and add these lines:

 log_statement = true
 syslog = 1
 syslog_facility = 'LOCAL0'
 syslog_ident = 'postgres'

Configure syslog appropriately and restart the services!