Re: log_statement per table

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: log_statement per table
Date: 2014-03-04 15:07:22
Message-ID: FD3BC4A1-AEBE-4A74-A96A-E814558751B4@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2014-03-04 15:11:28 Re: Why is varchar_pattern_ops needed?
Previous Message Adrian Klaver 2014-03-04 14:51:26 Re: Read tables of sql server with postgres