Re: 9.2 Reviewfest - logging hooks patch

Lists: pgsql-hackers
From: Christopher Maujean <cmaujean(at)pincsolutions(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: 9.2 Reviewfest - logging hooks patch
Date: 2012-01-13 03:29:18
Message-ID: CB34E50C.1634%cmaujean@pincsolutions.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Patch
<http://archives.postgresql.org/message-id/4EDBEFBB.9070509@gmail.com>

In reviewing the referenced patch, we found that it has no developer
documentation and no regression tests. While it compiles and installs,
there is nothing to tell us how to use (or test) it.

--Christopher

________________________________

Please consider the environment before printing this email.

The information contained in this email may be confidential and/or legally privileged. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please reply to the sender and destroy all copies of the message. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.


From: Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com>
To: Christopher Maujean <cmaujean(at)pincsolutions(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 9.2 Reviewfest - logging hooks patch
Date: 2012-01-15 17:36:53
Message-ID: 4F130EB5.4010303@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 01/13/2012 05:29 AM, Christopher Maujean wrote:
> Patch
> <http://archives.postgresql.org/message-id/4EDBEFBB.9070509@gmail.com>
>
>
> In reviewing the referenced patch, we found that it has no developer
> documentation and no regression tests. While it compiles and installs,
> there is nothing to tell us how to use (or test) it.
>

Thanks for reviewing!

I think the regression tests should be part of the module that uses
the hooks. Alas, there are none that we'd want to ship with Postgres
at this time.

The best I could offer for testing the hooks is a log forwarding module
I've been working on. Basically, what it does is that it installs the
hooks, looks at the message emitted by backend and if needed sends it
away via UDP. Available at: https://github.com/mpihlak/pg_logforward

To install, run "make install" and modify postgresql.conf to include:

shared_preload_libraries = 'pg_logforward'
logforward.target_names = 'jsonsrv'
logforward.jsonsrv_host = '127.0.0.1'
logforward.jsonsrv_port = 23456

Now, after restarting postgres, you could use "nc 23456 -u -l" to
receive the log. Alternatively use testing/test_logserver.py as a
log "server".

About documentation - it sure would be nice to have all the hooks
written up somewhere. Any suggestions as to where to put it?

regards,
Martin