Re: logging SQL statements

From: IJS/System - Joko <system(at)ijs(dot)co(dot)id>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: logging SQL statements
Date: 2008-10-11 01:27:45
Message-ID: 48F00111.7070801@ijs.co.id
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

It's surely possible.

Just enable this at postgresql.conf:
log_destination = 'stderr'
redirect_stderr = on

And then choose what to log:
log_statement = 'all'

Valid values are none, ddl, mod, and all. ddl logs all data definition
commands like CREATE, ALTER, and DROP commands. mod logs all ddl
statements, plus INSERT, UPDATE, DELETE, TRUNCATE, and COPY FROM.
PREPARE and EXPLAIN ANALYZE statements are also logged if their
contained command is of an appropriate type.

And u can modify other variables as you want.

Regards,
Joko [IT/EDP]
PT. Indra Jaya Swastika
Phone: +62 31 7481388 Ext 201
http://www.ijs.co.id

Jagadeesh wrote:
> On Oct 9, 6:23 pm, shreeseva(dot)learn(dot)(dot)(dot)(at)gmail(dot)com ("c k") wrote:
>
>> Is it possible to log all sql statements submitted to database server in a
>> table in that database it self? This will be different from database logs
>> which are written by db server.
>> Regards,
>> CPK
>>
>
> I am not confident but it should be posible. some settings like debug
> would log every thing in a logfile.
> Will check more on this and update.
> Thanks
>
>

--
If you have any problem with our services ,
please contact us at 70468146 or e-mail: helpdesk(at)ijs(dot)co(dot)id
PT Indra Jaya Swastika | Jl. Kalianak Barat 57A | +62-31-7481388

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Martin A. Brooks 2008-10-14 09:23:32 postgres seems to ignore log_min_duration_statement
Previous Message Evan Rempel 2008-10-10 22:25:00 Re: LDAP authentication

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2008-10-11 06:18:15 Re: calling a function that takes a row type and returns a set of rows
Previous Message Robert Treat 2008-10-10 22:30:11 Re: how to remove the duplicate records from a table