Skip site navigation (1) Skip section navigation (2)

Re: Database audit / Associating a statement with connection

From: Ben Kim <bkim(at)coe(dot)tamu(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Database audit / Associating a statement with connection
Date: 2005-04-16 04:07:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin

>Ben Kim <bkim(at)coe(dot)tamu(dot)edu> writes:
>> Is there a way to associate them so I know which statement came from which
>> connection?
> Log the PID originating each message.
>			regards, tom lane

This is a follow up in addition to the log pid. It's a vanilla solution,
but we tried comments like this in the sql statements.

in perl:

or in jsp: 
sql = "select ... from customers -- " + "url: " + request.getRequestURI()
+ " ip: " + request.getRemoteAddr();

This worked, and added the remote ip address and the page it came from
into the postgresql log nicely without needing a full setup. Till now we
didn't see a problem with it. Hoped someone might find this useful.


Ben Kim
Database Developer/Systems Administrator
434E Harrington Tower / College of Education 
Texas A&M University

In response to

pgsql-admin by date

Next:From: Marcin GiedzDate: 2005-04-16 05:35:16
Subject: Re: Out of memory problem.
Previous:From: Ian WestmacottDate: 2005-04-16 03:39:26
Subject: Re: database corruption

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group