Re: Loggingt psql meta-commands - Mailing list pgsql-general

From Scott Mead
Subject Re: Loggingt psql meta-commands
Date
Msg-id CAKq0gv+SserSvUTpe5qFHOGk5Vnwb9ztm0wX8mzjXCtkidaq5w@mail.gmail.com
Whole thread Raw
In response to Re: Loggingt psql meta-commands  (oleg yusim <olegyusim@gmail.com>)
Responses Re: Loggingt psql meta-commands  (Jerry Sievers <gsievers19@comcast.net>)
List pgsql-general
On Thu, Dec 10, 2015 at 2:50 PM, oleg yusim <olegyusim@gmail.com> wrote:
Thanks John, I realized that and confirmed in my logs. What I'm trying to determine now, can I only log some SELECT statements, or I should log all of them or none of them.

You can configure this to multiple levels:

 Global, per-user, per-database

ALTER USER postgres SET log_min_duration_statement=0;
ALTER DATABASE xyz SET log_min_duration_statement=0;

  That being said, you would want to make sure that the user issuing the largest volume of queries is not set with this, otherwise, you could potential flood your logs with every single query issued.  This has a tendency to cause performance problems.  The other item of note is that, once logged in, the user could change that value with a similar ALTER statement.


--Scott
PostgreSQL database experts

Oleg

On Thu, Dec 10, 2015 at 1:40 PM, John R Pierce <pierce@hogranch.com> wrote:
On 12/10/2015 9:58 AM, oleg yusim wrote:
I'm new to PostgreSQL, working on it from the point of view of Cyber Security assessment. In regards to the here is my question:

Is it a way to enable logging for psql prompt meta-commands, such as \du, \dp, \z, etc?

what the other two gentlemen are trying to say is the metacommands are shortcuts for more complex SQL queries of the pg_catalog schema, so to log them, you would need to log all queries and filter for accesses to the pg_catalog....



--
john r pierce, recycling bits in santa cruz




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


pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Loggingt psql meta-commands
Next
From: Adrian Klaver
Date:
Subject: Re: Loggingt psql meta-commands