Re: Log connection establishment timings - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Log connection establishment timings
Date
Msg-id Z8FPpJPDLHWNuV2c@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Log connection establishment timings  (Melanie Plageman <melanieplageman@gmail.com>)
List pgsql-hackers
Hi,

On Thu, Feb 27, 2025 at 05:55:19PM -0500, Melanie Plageman wrote:
> On Thu, Feb 27, 2025 at 11:30 AM Andres Freund <andres@anarazel.de> wrote:
> >
> > On 2025-02-27 11:08:04 -0500, Melanie Plageman wrote:
> >
> > > However, since that is a bigger project (with more refactoring, etc),
> > > he suggested that we change log_connections to a GUC_LIST
> > > (ConfigureNamesString) with options like "none", "received,
> > > "authenticated", "authorized", "all".
> >
> > Yep.
> 
> I've done a draft of this in attached v7 (see 0001).

Thanks for the patch!

> It still needs polishing (e.g. I need to figure out where to put the new guc hook
> functions and enums and such)

yeah, I wonder if it would make sense to create new dedicated "connection_logging"
file(s).

>, but I want to see if this is a viable direction forward.
> 
> I'm worried the list of possible connection log messages could get
> unwieldy if we add many more.

Thinking out loud, I'm not sure we'd add "many more" but maybe what we could do
is to introduce some predefined groups like:

'basic' (that would be equivalent to 'received, + timings introduced in 0002')
'security' (equivalent to 'authenticated,authorized')

Not saying we need to create this kind of predefined groups now, just an idea
in case we'd add many more: that could "help" the user experience, or are you
more concerned about the code maintenance?

Just did a quick test, (did not look closely at the code), and it looks like
that:

'all': does not report the "received" (but does report authenticated and authorized)
'received': does not work?
'authenticated': works
'authorized': works

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Remove extra Sort node above a btree-compatible Index Scan
Next
From: Sagar Shedge
Date:
Subject: Re: Extend postgres_fdw_get_connections to return remote backend pid