Re: Database audit / Associating a statement with connection

Поиск
Список
Период
Сортировка
От Ben Kim
Тема Re: Database audit / Associating a statement with connection
Дата
Msg-id Pine.GSO.4.10.10504152238220.27871-100000@edsun.coe.tamu.edu
обсуждение исходный текст
Ответ на Re: Database audit / Associating a statement with connection  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin

>Ben Kim <bkim@coe.tamu.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:
$sql=$sql." -- IP=$ENV{REMOTE_ADDR},ID=$id,PAGE=$ENV{SCRIPT_FILENAME}";

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.



Regards,

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


В списке pgsql-admin по дате отправления:

Предыдущее
От: "Ian Westmacott"
Дата:
Сообщение: Re: database corruption
Следующее
От: Marcin Giedz
Дата:
Сообщение: Re: Out of memory problem.