Thread: Logging Question

Logging Question

From
"Mag Gam"
Date:
Hi pgsql-novice:

I am using 8.3 and trying to build a log analyzer to take stats. I am trying to log the following:
Database Connection: Database Name, so I know which database its on
Statement: SELECT, INSERT, UPDATE, DELETE
Timestamp of Statement
Duration of statement (could be important for performance tuning)

And most important, I would like a record seperator, "<**** >", after each log entry so my parser can know when to start and stop, for example:

<****>
foo_db: select * from some_table: Feb 21, 2008: 1s
<****>

Is this possible to do? Are there internal catalog command I can use instead?

Any thoughts?

TIA

Re: Logging Question

From
Tom Lane
Date:
"Mag Gam" <magawake@gmail.com> writes:
> I am using 8.3 and trying to build a log analyzer to take stats.

Use the CSV log capability, instead of inventing your own ad-hoc
(and obviously fragile) log format.

            regards, tom lane

Re: Logging Question

From
"Mag Gam"
Date:
Great Idea Tom.
Will ready up against this.

I think a 'contrib' module would be feasible for stuff like this :-)


On Sun, Feb 24, 2008 at 5:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Mag Gam" <magawake@gmail.com> writes:
> I am using 8.3 and trying to build a log analyzer to take stats.

Use the CSV log capability, instead of inventing your own ad-hoc
(and obviously fragile) log format.

                       regards, tom lane