Re: 9.2 Reviewfest - logging hooks patch

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
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joachim Wieland 2012-01-15 18:01:43 patch for parallel pg_dump
Previous Message Tom Lane 2012-01-15 17:20:44 Re: pgstat documentation tables