connection logging dtrace probe

Поиск
Список
Период
Сортировка
От Robert Treat
Тема connection logging dtrace probe
Дата
Msg-id 200902121743.08659.xzilla@users.sourceforge.net
обсуждение исходный текст
Ответы Re: connection logging dtrace probe
Список pgsql-hackers
I whipped up a quick dtrace probe for one of our servers to monitor connection 
attempts.  My goal was to monitor for any connection attempts from a specific 
role within the database.  Unfortunatly you can't set logging of connections 
for a specific user, and logging all connections on that machine would be 
quite the logfile bloater... enter dtrace. With the probe, I can do something 
like this:

-bash-3.00$ /opt/csw/bin/sudo dtrace -n 'postgresql*:::connection 
{printf("connection attempt: %s@%s\n",copyinstr(arg0),copyinstr(arg1)) }' | 
grep robert
dtrace: description 'postgresql*:::connection ' matched 5 probes 2  18984            ServerLoop:connection connection
attempt:robert@robert 2  16222            ServerLoop:connection connection attempt: robert@robert 1  16876
ServerLoop:connectionconnection attempt: robert@pagila
 

which can be piped to logfile or whatever. I'm attaching a patch against 8.4 
as an idea of what I've implemented (actual implementation was against a 
custom build) but should be close to working (don't have a working pg repo on 
any solaris machines atm). Any feedback appreciated (mostly wondering about 
probe name or location). TIA

-- 
Robert Treat
Conjecture: http://www.xzilla.net
Consulting: http://www.omniti.com

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [ADMIN] database corruption help
Следующее
От: Matteo Beccati
Дата:
Сообщение: Re: DISCARD ALL failing to acquire locks on pg_listen