pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shane Ambler <pgsql@Sheeky.Biz>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-admin@postgresql.org, Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
Subject: Re: conditional logging based on client
Date: Wed, 23 Jul 2008 04:17:51 +0930
Message-ID: <48862B57.2050402@Sheeky.Biz> (raw)
In-Reply-To: <200807221524.45181.achill@matrix.gatewaynet.com>
References: <a97c77030807220517u2324a0cckb8400a359123426a@mail.gmail.com>
	<200807221524.45181.achill@matrix.gatewaynet.com>

Achilleas Mantzios wrote:
> Στις Tuesday 22 July 2008 15:17:42 ο/η Rajesh Kumar Mallah
> έγραψε:
>> Hi,
>> 
>> We want to log all SQLs that has been executed by using psql
>> client. we do not want to use .psql_history as it is distributed
>> and may be deleted by users .
>> 
>> The original objective is that we should be able to know what all
>> hand made SQLs have  been executed in past  (which can date back as
>> long as 1 year even)
> 
> You have to adjust log_statement in your postgresql.conf however you
> will have to bear in mind the performance implications of this. 
> Normal production sites dont do this. You can enable/disable this
> kind of logging any time by killing -HUP

I am thinking that is a bit more than what you want. You can log all sql
statements run on a server but the server can't differentiate between
your custom-app sent sql and hand made sql sent through psql.

I know you can add things like remote address, username, dbname,
sessionid to the start of each log line but I don't know of getting the
client app name.


My thought would be to enable the statement logging and to modify your
client apps to have a set comment at the beginning and end of all sql
statements sent. You could then filter these sql statements out of the
logs leaving you with hand crafted sql.



-- 

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz



view thread (7+ messages)  latest in thread

Message-ID: <48862B57.2050402@Sheeky.Biz>
Permalink:  ../48862B57.2050402@Sheeky.Biz/
Also on:    postgresql.org/message-id/48862B57.2050402@Sheeky.Biz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: pgsql@Sheeky.Biz, achill@matrix.gatewaynet.com, mallah.rajesh@gmail.com
  Subject: Re: conditional logging based on client
  In-Reply-To: <48862B57.2050402@Sheeky.Biz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox