log_statement setting
log_statement setting
От:
Jayadevan M <maymala.jayadevan@gmail.com>
Дата:
Hello all,
A doubt on the setting 'log_statement'. Is it possible to set this at database/user level?
I get 'all' when I try
select * from pg_settings where name = 'log_statement'
Does this mean all statements by any user on any database in that server are getting logged? This is for auditing purposes.
Regards,
Jayadevan
Re: log_statement setting
От:
Bruce Momjian <bruce@momjian.us>
Дата:
On Wed, Aug 18, 2021 at 09:34:08PM +0530, Jayadevan M wrote: > Hello all, > > A doubt on the setting 'log_statement'. Is it possible to set this at database > /user level? Sure, ALTER USER/DATABASE ... SET. > I get 'all' when I try > select * from pg_settings where name = 'log_statement' > Does this mean all statements by any user on any database in that server are > getting logged? This is for auditing purposes. Yes. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.
Re: log_statement setting
От:
Jayadevan M <maymala.jayadevan@gmail.com>
Дата:
On Wed, Aug 18, 2021 at 9:36 PM Bruce Momjian <bruce@momjian.us> wrote:
On Wed, Aug 18, 2021 at 09:34:08PM +0530, Jayadevan M wrote:
> Hello all,
>
> A doubt on the setting 'log_statement'. Is it possible to set this at database
> /user level?
Sure, ALTER USER/DATABASE ... SET.
Thank you. Follow up question- If it is set to different values for different users/databases, how can I get those values? For example,
I have a server with 4 databases. If I just query pg_settings, I get only one value.
> I get 'all' when I try
> select * from pg_settings where name = 'log_statement'
> Does this mean all statements by any user on any database in that server are
> getting logged? This is for auditing purposes.
Yes.
Thanks.
Re: log_statement setting
От:
Julien Rouhaud <rjuju123@gmail.com>
Дата:
On Thu, Aug 19, 2021 at 1:55 PM Jayadevan M wrote: > > Thank you. Follow up question- If it is set to different values for different users/databases, how can I get those values? For example, > I have a server with 4 databases. If I just query pg_settings, I get only one value. The value you see on pg_settings is the one that's selected for your current connection, based on the database/role you used. You can use \drds in psql to see the various configurations, or query the pg_db_role_setting table.
Re: log_statement setting
От:
Jayadevan M <maymala.jayadevan@gmail.com>
Дата:
On Thu, Aug 19, 2021 at 11:41 AM Julien Rouhaud <rjuju123@gmail.com> wrote:
The value you see on pg_settings is the one that's selected for your
current connection, based on the database/role you used.
You can use \drds in psql to see the various configurations, or query
the pg_db_role_setting table.
Thank you. Pointing to pg_db_role_setting was very helpful. I was able to get the data I wanted.
Regards,
Jay