Thread: pg_log - automatic logging of every transaction? how to access?

pg_log - automatic logging of every transaction? how to access?

From
Richard Fromm
Date:
I'm trying to figure out if postgres logs every transaction somewhere, and if
so, how to access that.

From my own exploring, as well as reading the archives of the pgsql-novice,
pgsql-general, and pgsql-questions mailing lists, I'm assuming that this is
the purpose of pg_log (and/or pg_time?).

I see that the modification times of those files are updated whenever I
perform an SQL query, but I can't directly access them:

lounge=> select * from pg_log;
WARN:pg_log cannot be accessed by users
lounge=> select * from pg_time;
WARN:pg_time cannot be accessed by users

Is this the purpose of these files, and if so, how do I get at them?

Or if I want to keep track of certain transactions, do I have to create a log
relation within the database and update it with transactions that I care
about?  (Which seems like a hack that I'm assuming is unnecessary.)

Numerous people have asked questions about this in the past, but I have not
been able to find a single response.  The only responses had to do with a (now
fixed) postgres bug that caused pg_time and pg_log to grow unnecessarily large.

- Rich Fromm
rfromm@cs.berkeley.edu

p.s. Apologies in advance for cross-posting to pgsql-novice and pgsql-general;
I wasn't sure which was more appropriate.