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 1u2uKW-007c85-0Q for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Apr 2025 16:00:40 +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 1u2uKU-00Dsfp-Eu for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Apr 2025 16:00:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2uKU-00Dsei-54 for pgsql-hackers@lists.postgresql.org; Thu, 10 Apr 2025 16:00:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u2uKS-0045Ih-16 for pgsql-hackers@lists.postgresql.org; Thu, 10 Apr 2025 16:00:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53AG0WY6525680; Thu, 10 Apr 2025 12:00:32 -0400 From: Tom Lane To: Adrian Klaver cc: "Tefft, Michael J" , pgsql-hackers@lists.postgresql.org, Melanie Plageman Subject: Re: Capturing both IP address and hostname in the log In-reply-to: <97cfc252-9a26-489e-b458-999ac5589224@aklaver.com> References: <97cfc252-9a26-489e-b458-999ac5589224@aklaver.com> Comments: In-reply-to Adrian Klaver message dated "Thu, 10 Apr 2025 08:22:56 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <525678.1744300832.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 10 Apr 2025 12:00:32 -0400 Message-ID: <525679.1744300832@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk [ moving to -hackers ] Adrian Klaver writes: > On 4/10/25 05:22, Tefft, Michael J wrote: >> We have set log_hostname ON and we get hostname reported – but we do not >> get IP address. We would like to capture both. >> Is there a way to capture both IP address and hostname in the log >> messages? Or must we choose “one or the ootehr”? > I see the same thing. It seems either or. Melanie recently committed a patch (9219093ca) that purports to generalize our log_connections logging ability: Convert the boolean log_connections GUC into a list GUC comprised of the connection aspects to log. This gives users more control over the volume and kind of connection logging. The current log_connections options are 'receipt', 'authentication', and 'authorization'. The empty string disables all connection logging. 'all' enables all available connection logging. I wonder if it'd be reasonable to remove the separate log_hostname GUC and fold it into this infrastructure, and while doing so make it possible to log either or both of the client IP address and hostname. (For that matter, I think there is interest in being able to capture the server IP address too, cf 3516ea768. You might wish to log the IP address only once, not in every log line.) regards, tom lane