Logging Postgres queries
Here’s how to configure Postgres to write all queries to log file that you can follow.
Edit postgresql.conf (usually in /etc/postgresql/8.4/main/
) to contain these lines:
log_statement=‘all’ log_destination=‘csvlog’ logging_collector=on
Now, the log should appear at /etc/postgresql/8.4/main/pg_log/*.csv