Re: [GENERAL] Audit based on role

2017-08-09 Thread anand086
Thank you all for your input. We plan to use ALTER USER username SET log_statement = mod when the user account is created. Regards, Anand -- View this message in context: http://www.postgresql-archive.org/Audit-based-on-role-tp5976507p5977104.html Sent from the PostgreSQL - general mailing

Re: [GENERAL] Audit based on role

2017-08-08 Thread Joe Conway
On 08/07/2017 06:59 PM, Melvin Davidson wrote: > *You can tweak the following query to help you determine if your user is > a member of role/group 'module_dml'. > * > *Then you can use it in a trigger function that does the logging. > > SELECT g.rolname as group, >u.rolname as user, >

Re: [GENERAL] Audit based on role

2017-08-08 Thread Arthur Zakirov
Hello, On Mon, Aug 07, 2017 at 04:33:21PM -0700, anand086 wrote: > Hi, > > I am postgres newbie. > > We are running Postgres 9.6.3 version and have requirement, where we want to > audit any DML action performed by a user whose has module_dml role granted. > > What would be the best way to do

Re: [GENERAL] Audit based on role

2017-08-08 Thread pinker
Hi, I personally don't like the solution from https://wiki.postgresql.org/wiki/Audit_trigger and here are the reasons why: * it produces a large table where all the changes, from all tables and schemas go - audit.logged_actions. So when you would like to read it to check anything it will be super

Re: [GENERAL] Audit based on role

2017-08-07 Thread Melvin Davidson
*You can tweak the following query to help you determine if your user is a member of role/group 'module_dml'.* *Then you can use it in a trigger function that does the logging.SELECT g.rolname as group, u.rolname as user, r.admin_option as admin, g.rolsuper as

Re: [GENERAL] Audit based on role

2017-08-07 Thread Joe Conway
On 08/07/2017 04:47 PM, anand086 wrote: > Only Insert/Update/Delete sqls are to be audited. You could get close to what you want, I think, by setting log_statement = mod for the users of interest, e.g. by doing: ALTER USER whomever SET log_statement = mod; See:

Re: [GENERAL] Audit based on role

2017-08-07 Thread anand086
Only Insert/Update/Delete sqls are to be audited. -- View this message in context: http://www.postgresql-archive.org/Audit-based-on-role-tp5976507p5976509.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list

Re: [GENERAL] Audit based on role

2017-08-07 Thread John R Pierce
On 8/7/2017 4:33 PM, anand086 wrote: We are running Postgres 9.6.3 version and have requirement, where we want to audit any DML action performed by a user whose has module_dml role granted. What would be the best way to do that? I was thinking to write something

[GENERAL] Audit based on role

2017-08-07 Thread anand086
Hi, I am postgres newbie. We are running Postgres 9.6.3 version and have requirement, where we want to audit any DML action performed by a user whose has module_dml role granted. What would be the best way to do that? I was thinking to write something like