Re: How To Log User Name + Database? - Mailing list pgsql-general

From Ed Loehr
Subject Re: How To Log User Name + Database?
Date
Msg-id 3A2E7E75.4EF64A10@austin.rr.com
Whole thread Raw
In response to How To Log User Name + Database?  (Ed Loehr <eloehr@austin.rr.com>)
Responses Re: How To Log User Name + Database?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
>
> Ed Loehr <eloehr@austin.rr.com> writes:
> > Can anyone tell me how to log the db user name and db name to the server
> > log?  Is this possible at present?
>
> Offhand I don't think that happens at the moment, but it does seem like
> it'd be a good idea to have a backend do an elog(DEBUG) at startup that
> mentions its database name and user name.  Assuming you have logging of
> timestamps/PIDs turned on, that would be enough to correlate later log
> messages with a user name.
>
> Comments anyone?

That'd be an improvement.  Considering the case where you have many users
and many dbs, with log lines co-mingled.  Would it be better to
(optionally) allow the db name and user name to be logged on each line?
That way, you wouldn't have to do the visual correlation with a line
possibly tens or hundreds of lines earlier in the log.  It might also
simplify log processing scripts a bit.

Regards,
Ed Loehr

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How To Log User Name + Database?
Next
From: "Francis Solomon"
Date:
Subject: RE: apache .htaccess / postgresql module