logging SQL statements

View: New views
3 Messages — Rating Filter:   Alert me  

logging SQL statements

by c k-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: logging SQL statements

by Jagadeesh-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 9, 6:23 pm, shreeseva.learn...@... ("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

--
Sent via pgsql-admin mailing list (pgsql-admin@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: logging SQL statements

by System/IJS - Joko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.learn...@... ("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@...
PT Indra Jaya Swastika | Jl. Kalianak Barat 57A | +62-31-7481388
LightInTheBox - Buy quality products at wholesale price!