pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
User specific log file in Postgres
5+ messages / 4 participants
[nested] [flat]

* User specific log file in Postgres
@ 2021-11-23 11:54 Daulat <daulat.dba@gmail.com>
  2021-11-23 12:49 ` Re: User specific log file in Postgres hubert depesz lubaczewski <depesz@depesz.com>
  2021-11-23 12:52 ` RE: User specific log file in Postgres Michel SALAIS <msalais@msym.fr>
  0 siblings, 2 replies; 5+ messages in thread

From: Daulat @ 2021-11-23 11:54 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hello Team,

Is it possible to set up individual logging files for specific users in
Postgresql?

Please suggest !

Thanks

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: User specific log file in Postgres
  2021-11-23 11:54 User specific log file in Postgres Daulat <daulat.dba@gmail.com>
@ 2021-11-23 12:49 ` hubert depesz lubaczewski <depesz@depesz.com>
  1 sibling, 0 replies; 5+ messages in thread

From: hubert depesz lubaczewski @ 2021-11-23 12:49 UTC (permalink / raw)
  To: Daulat <daulat.dba@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

On Tue, Nov 23, 2021 at 05:24:23PM +0530, Daulat wrote:
> Is it possible to set up individual logging files for specific users in
> Postgresql?

Technically yes. Practically - no.

You could redirect logs to syslog, and make syslog filter messages based
on user, but it's unlikely to work well.

Best regards,

depesz






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: User specific log file in Postgres
  2021-11-23 11:54 User specific log file in Postgres Daulat <daulat.dba@gmail.com>
@ 2021-11-23 12:52 ` Michel SALAIS <msalais@msym.fr>
  2021-11-23 19:14   ` Re: User specific log file in Postgres Dan Smith <j.daniel.smith1@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Michel SALAIS @ 2021-11-23 12:52 UTC (permalink / raw)
  To: 'Daulat' <daulat.dba@gmail.com>; pgsql-admin@lists.postgresql.org

Hi,

 

If you mean the “standard” logging system for PostgreSQL the reply is No. Parameter “log_filename” is of context “sighup” and can’t be modified by session…

 

Michel SALAIS

Consultant Oracle, PostgreSQL

MSYM

23 rue du Départ

Boîte 37

75014 Paris

 

+33 6 68 94 19 60

 <mailto:msalais@msym.fr> msalais@msym.fr

 <http://www.msym.fr/; www.msym.fr

 

De : Daulat <daulat.dba@gmail.com> 
Envoyé : mardi 23 novembre 2021 12:54
À : pgsql-admin@lists.postgresql.org
Objet : User specific log file in Postgres

 

Hello Team,

 

Is it possible to set up individual logging files for specific users in Postgresql?

 

Please suggest !

 

Thanks

 

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: User specific log file in Postgres
  2021-11-23 11:54 User specific log file in Postgres Daulat <daulat.dba@gmail.com>
  2021-11-23 12:52 ` RE: User specific log file in Postgres Michel SALAIS <msalais@msym.fr>
@ 2021-11-23 19:14   ` Dan Smith <j.daniel.smith1@gmail.com>
  2021-11-24 08:50     ` Re: User specific log file in Postgres Daulat <daulat.dba@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Dan Smith @ 2021-11-23 19:14 UTC (permalink / raw)
  To: pgsql-admin <pgsql-admin@lists.postgresql.org>

Here are a couple of ideas that are outside of the direct question.

I believe you can target one or more users with the pgaudit extension.
Look for Session Audit Logging.
Example "ALTER ROLE role_name SET pgaudit.log = 'all, -misc';".
https://github.com/pgaudit/pgaudit#session-audit-logging

Some clients such as psql will also allow you to write history per host /
user.  ~/.psqlrc file add "\set HISTFILE ~/.psql_history_ :HOST _ :USER _
:DBNAME" for example.

Both of these should be well documented and relatively easy to test to see
if they might be of some assistance for you.

Hope this helps.


Best regards,

Dan Smith

On Tue, Nov 23, 2021, 04:52 Michel SALAIS <msalais@msym.fr> wrote:

> Hi,
>
>
>
> If you mean the “standard” logging system for PostgreSQL the reply is No.
> Parameter “log_filename” is of context “sighup” and can’t be modified by
> session…
>
>
>
> *Michel SALAIS*
>
> *Consultant Oracle, PostgreSQL*
>
> *MSYM*
>
> *23 rue du Départ*
>
> *Boîte 37*
>
> *75014 Paris*
>
>
>
> *+33 6 68 94 19 60*
>
> *msalais@msym.fr <msalais@msym.fr>*
>
> *www.msym.fr <http://www.msym.fr/>*
>
>
>
> *De :* Daulat <daulat.dba@gmail.com>
> *Envoyé :* mardi 23 novembre 2021 12:54
> *À :* pgsql-admin@lists.postgresql.org
> *Objet :* User specific log file in Postgres
>
>
>
> Hello Team,
>
>
>
> Is it possible to set up individual logging files for specific users in
> Postgresql?
>
>
>
> Please suggest !
>
>
>
> Thanks
>
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: User specific log file in Postgres
  2021-11-23 11:54 User specific log file in Postgres Daulat <daulat.dba@gmail.com>
  2021-11-23 12:52 ` RE: User specific log file in Postgres Michel SALAIS <msalais@msym.fr>
  2021-11-23 19:14   ` Re: User specific log file in Postgres Dan Smith <j.daniel.smith1@gmail.com>
@ 2021-11-24 08:50     ` Daulat <daulat.dba@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Daulat @ 2021-11-24 08:50 UTC (permalink / raw)
  To: Dan Smith <j.daniel.smith1@gmail.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

Thanks Dan Smith,
Will it log queries executed from PGADMIN? I think no.

Regards,


On Wed, Nov 24, 2021 at 12:45 AM Dan Smith <j.daniel.smith1@gmail.com>
wrote:

> Here are a couple of ideas that are outside of the direct question.
>
> I believe you can target one or more users with the pgaudit extension.
> Look for Session Audit Logging.
> Example "ALTER ROLE role_name SET pgaudit.log = 'all, -misc';".
> https://github.com/pgaudit/pgaudit#session-audit-logging
>
> Some clients such as psql will also allow you to write history per host /
> user.  ~/.psqlrc file add "\set HISTFILE ~/.psql_history_ :HOST _ :USER _
> :DBNAME" for example.
>
> Both of these should be well documented and relatively easy to test to see
> if they might be of some assistance for you.
>
> Hope this helps.
>
>
> Best regards,
>
> Dan Smith
>
> On Tue, Nov 23, 2021, 04:52 Michel SALAIS <msalais@msym.fr> wrote:
>
>> Hi,
>>
>>
>>
>> If you mean the “standard” logging system for PostgreSQL the reply is No.
>> Parameter “log_filename” is of context “sighup” and can’t be modified by
>> session…
>>
>>
>>
>> *Michel SALAIS*
>>
>> *Consultant Oracle, PostgreSQL*
>>
>> *MSYM*
>>
>> *23 rue du Départ*
>>
>> *Boîte 37*
>>
>> *75014 Paris*
>>
>>
>>
>> *+33 6 68 94 19 60*
>>
>> *msalais@msym.fr <msalais@msym.fr>*
>>
>> *www.msym.fr <http://www.msym.fr/>*
>>
>>
>>
>> *De :* Daulat <daulat.dba@gmail.com>
>> *Envoyé :* mardi 23 novembre 2021 12:54
>> *À :* pgsql-admin@lists.postgresql.org
>> *Objet :* User specific log file in Postgres
>>
>>
>>
>> Hello Team,
>>
>>
>>
>> Is it possible to set up individual logging files for specific users in
>> Postgresql?
>>
>>
>>
>> Please suggest !
>>
>>
>>
>> Thanks
>>
>>
>>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-11-24 08:50 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 11:54 User specific log file in Postgres Daulat <daulat.dba@gmail.com>
2021-11-23 12:49 ` hubert depesz lubaczewski <depesz@depesz.com>
2021-11-23 12:52 ` Michel SALAIS <msalais@msym.fr>
2021-11-23 19:14   ` Dan Smith <j.daniel.smith1@gmail.com>
2021-11-24 08:50     ` Daulat <daulat.dba@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox