Re: Loggingt psql meta-commands

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: oleg yusim <olegyusim(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Jerry Sievers <gsievers19(at)comcast(dot)net>, Scott Mead <scottm(at)openscg(dot)com>, John R Pierce <pierce(at)hogranch(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Loggingt psql meta-commands
Date: 2015-12-10 22:41:22
Message-ID: 21967.1449787282@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

oleg yusim <olegyusim(at)gmail(dot)com> writes:
> What I hope to achieve is to meet this requirement from Database SRG:
> *Review DBMS documentation to verify that audit records can be produced
> when privileges/permissions/role memberships are retrieved.*

> To do that I would need to enable logging of such commands as \du, \dp, \z.
> At the same time, I do not want to get 20 GB of logs on the daily basis, by
> setting log_statement = 'all'. So, I'm trying to find a way in between.

As multiple people have noted, it's a serious error to imagine that your
requirement is "log \du etc". Those are just handy macros for queries on
the system catalogs, which could also be done in other ways. What you
seem to need is server-side logging of queries that access specific system
catalog columns. There's no out-of-the-box facility for that right now,
short of log_statement = all which you've already rejected.

It'd be possible to write a C-code extension that did something like
that, and some work in that direction has already gone on; the pg_audit
extension that didn't quite get into 9.5 might come close to your
requirements.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-12-10 22:45:39 Re: Loggingt psql meta-commands
Previous Message oleg yusim 2015-12-10 22:13:48 Re: Loggingt psql meta-commands