Re: log_statement per table

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Steve Atkins <steve(at)blighty(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: log_statement per table
Date: 2014-03-09 23:32:14
Message-ID: CAMkU=1yLEe8siEiywug7S2-JjS95f9uo-wzspNh+DVzoJ8nKew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 4, 2014 at 7:07 AM, Steve Atkins <steve(at)blighty(dot)com> wrote:

>
> On Mar 4, 2014, at 2:19 AM, David Janssens <david(dot)j(at)almacom(dot)co(dot)th> wrote:
>
> > Hello,
> > I would like to log statements that modify a small subset of tables in a
> databases.
> > (not all tables, because the log files become too big in that case and I
> also worry about performance)
> > I currently use log_statement='mod' but I didn't find a way to limit
> this to the set of tables I want.
> > What is the best way to do this?
>
> You might want to look at trigger based audit logs.
>
> Some example code, and a couple of useful packages:
>
>
> http://www.postgresql.org/docs/current/static/plpgsql-trigger.html#PLPGSQL-TRIGGER-AUDIT-EXAMPLE
> https://github.com/disqus/pg_audit
> http://pgfoundry.org/projects/tablelog/
> http://jimmyg.org/blog/2007/audit-tables-in-postgresql-with-debian.html
> http://www.varlena.com/GeneralBits/104.php

I don't know about the other packages, but I would recommend against
"tablelog". While I'm happy with what it does (once hand-patched to work
with modern versions of the server), it is an abandoned project with no
apparent avenue for reviving it. I wouldn't recommend becoming dependent
on such "living dead" software if you are not already.

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-03-10 00:26:40 Re: libpq - lack of support to set the fetch size
Previous Message matshyeq 2014-03-09 13:43:35 libpq - lack of support to set the fetch size