Re: [GENERAL] How to get login user name and host name in pgaudit - Mailing list pgsql-general

From Arthur Zakirov
Subject Re: [GENERAL] How to get login user name and host name in pgaudit
Date
Msg-id 20171022191530.GA2004@arthur.localdomain
Whole thread Raw
In response to [GENERAL] How to get login user name and host name in pgaudit  (rakeshkumar464 <rakeshkumar464@outlook.com>)
List pgsql-general
On Sun, Oct 22, 2017 at 05:32:56AM -0700, rakeshkumar464 wrote:
> I installed latest pgaudit (1.2) with pg10.  I am testing it and I see that
> it does not log the login user name and host name. 
> 
> For example, if user mary is running select * from sensitive_table, I want
> Mary and the machine from where she ran in the log.
> 
> It seems to log the ids which needs to be joined with pg_ views to convert
> it into login user name and host name.
> 
> any pointers on how to get it done.
> 
> thanks.
> 

According to the README [1] you need to set the log_line_prefix GUC
variable [2]. It's default value is '%m [%p]'. For example:

=# alter system set log_line_prefix to '%m [%p] %u %h';
=# select pg_reload_conf();

This GUC variable will change all log lines of PostgreSQL, not only
pgaudit's.


1 - https://github.com/pgaudit/pgaudit#format
2 - https://www.postgresql.org/docs/10/static/runtime-config-logging.html#guc-log-line-prefix

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


-- 
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: Tom Lane
Date:
Subject: Re: [GENERAL] parray_gin and \d errors in PG10
Next
From: Arthur Zakirov
Date:
Subject: Re: [GENERAL] tgrm index for word_similarity