Auditing with shared username
| От | Eric E |
|---|---|
| Тема | Auditing with shared username |
| Дата | |
| Msg-id | 41B48FAC.10306@bonbon.net обсуждение исходный текст |
| Список | pgsql-general |
Hi all,
Like many folks who use three-tier design, I would like to create an
audit trail in my Postgres database, and I would like to do so without
having to create a database user for each audit.
As I see it, there are two ways to do this, and I can't see a clear way
to do either of them. If anyone has better suggestions, I'd of course
love to hear them.
Here's what I'd thought up:
1) Connect my homebrew login system which runs out of a couple database
tables to postgres connection/sessionID (i.e., keep track of which
sessionID represents my current user) so that any audit function can use
the session ID to look up the current user.
2) Maintain a "current homebrew user" session variable that is distinct
from Postgres' current_user, which I believe stores the current database
user. I found a couple threads on session variables, but mostly they
were discouraging people from using such variables.
Does anyone have any good ideas or advice?
Also, both of these methods require that a user maintain his/her own
session. I don't know how PG's connection pooling works, but is it
actually possible to specify a particular session for a particular
user? Is there some place I can find documentation on how Postgres
deals with logins and sessions?
Many thanks,
Eric
В списке pgsql-general по дате отправления: