Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpK9t-003Z31-Tf for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Mar 2025 04:45:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tpK9s-005urx-Jx for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Mar 2025 04:45:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpK9s-005urp-9X for pgsql-hackers@lists.postgresql.org; Tue, 04 Mar 2025 04:45:32 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tpK9n-000pnH-34 for pgsql-hackers@postgresql.org; Tue, 04 Mar 2025 04:45:31 +0000 Received: from [192.168.11.9] (p1695135-ipoe.ipoe.ocn.ne.jp [118.0.92.134]) by oss.nttdata.com (Postfix) with ESMTPSA id 98177607D0; Tue, 4 Mar 2025 13:45:22 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <0f704b53-0535-47de-b600-e11ad0558314@oss.nttdata.com> Date: Tue, 4 Mar 2025 13:45:21 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Log connection establishment timings To: Melanie Plageman , Bertrand Drouvot Cc: Andres Freund , Guillaume Lelarge , Pg Hackers , Daniel Gustafsson , andrey.chudnovskiy@microsoft.com, Jelte Fennema-Nio , Jacob Champion References: <65fe2d68-a214-40f0-80a8-56ca7323ad5c@oss.nttdata.com> <7d3fcftmqsm2vounbkmkqnwbqkovsizgdkow46qo7nunau4q2n@pyavjiltbqnu> Content-Language: en-US From: Fujii Masao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/03/01 7:52, Melanie Plageman wrote: > On Fri, Feb 28, 2025 at 12:54 AM Bertrand Drouvot > wrote: >> >> On Thu, Feb 27, 2025 at 05:55:19PM -0500, Melanie Plageman wrote: >>> 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). > > I think for now there isn't enough for a new file. I think these are > probably okay in postmaster.c since this has to do with postmaster > starting new connections. > >>> 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? > > I was more worried about the user having to provide very long lists. > But groupings could be a sensible solution in the future. > >> 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 > > Thanks for testing! Ouch, there were many bugs in that prototype. My > enums were broken and a few other things. > > I found some bugs in 0002 as well. Attached v8 fixes the issues I found so far. > > We have to be really careful about when log_connections is actually > set before we use it -- I fixed some issues with that. When log_connection is empty string in postgresql.conf and I ran "psql -d "options=-clog_connections=all"", I got the following log message. You can see the total duration in this message is unexpected. It looks like this happens because creation_time wasn’t collected, as log_connections was empty before the fork. LOG: connection establishment times (ms): total: 1148052469, fork: 0, authentication: 0 Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION