log_statement = 'mod' does not log all data modifying statements

Started by Jack Christensenalmost 11 years ago5 messagesgeneral
Jump to latest
#1Jack Christensen
jack@jackchristensen.com

I was recently surprised by changes that were not logged by
log_statement = 'mod'. After changing log_statement to 'all', I found
that the changes were occurring in a writable CTE.

Is there a way to log all statements that update data?

Jack

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Bruce Momjian
bruce@momjian.us
In reply to: Jack Christensen (#1)
Re: log_statement = 'mod' does not log all data modifying statements

On Fri, Jun 12, 2015 at 01:54:30PM -0500, Jack Christensen wrote:

I was recently surprised by changes that were not logged by
log_statement = 'mod'. After changing log_statement to 'all', I
found that the changes were occurring in a writable CTE.

Is there a way to log all statements that update data?

Not really. Is this something we should document better?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Stephen Frost
sfrost@snowman.net
In reply to: Bruce Momjian (#2)
Re: log_statement = 'mod' does not log all data modifying statements

* Bruce Momjian (bruce@momjian.us) wrote:

On Fri, Jun 12, 2015 at 01:54:30PM -0500, Jack Christensen wrote:

I was recently surprised by changes that were not logged by
log_statement = 'mod'. After changing log_statement to 'all', I
found that the changes were occurring in a writable CTE.

Is there a way to log all statements that update data?

Not really. Is this something we should document better?

pg_audit handles this (it is one of the specific goals of that project,
in fact) and the case where modifications are done inside of DO blocks
and PL code. Further, it provides a great deal of additional
flexibility.

What we need here is better logging/auditing capabilities in core.
Improving the documentation for the back-branches is good but doesn't
address this use-case. It's unfortunate that we don't have a better
answer at this time.

Thanks!

Stephen

#4Igor Neyman
ineyman@perceptron.com
In reply to: Stephen Frost (#3)
Re: log_statement = 'mod' does not log all data modifying statements

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Stephen Frost
Sent: Wednesday, September 09, 2015 10:17 AM
To: Bruce Momjian <bruce@momjian.us>
Cc: Jack Christensen <jack@jackchristensen.com>; pgsql-general@postgresql.org
Subject: Re: [GENERAL] log_statement = 'mod' does not log all data modifying statements

* Bruce Momjian (bruce@momjian.us) wrote:

On Fri, Jun 12, 2015 at 01:54:30PM -0500, Jack Christensen wrote:

I was recently surprised by changes that were not logged by
log_statement = 'mod'. After changing log_statement to 'all', I
found that the changes were occurring in a writable CTE.

Is there a way to log all statements that update data?

Not really. Is this something we should document better?

pg_audit handles this (it is one of the specific goals of that project, in fact) and the case where modifications are done inside of DO blocks and PL code. Further, it provides a great deal of additional flexibility.

What we need here is better logging/auditing capabilities in core.
Improving the documentation for the back-branches is good but doesn't address this use-case. It's unfortunate that we don't have a better answer at this time.

Thanks!

Stephen

_______________________

Could you please provide reference to pg_audit?

TIA,
Igor Neyman

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Michael Paquier
michael@paquier.xyz
In reply to: Igor Neyman (#4)
Re: log_statement = 'mod' does not log all data modifying statements

On Wed, Sep 9, 2015 at 11:24 PM, Igor Neyman wrote:

Could you please provide reference to pg_audit?

Should be here:
http://pgaudit.org/
https://github.com/pgaudit/pgaudit
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general