public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Tom Lane <[email protected]>
Cc: Adrian Klaver <[email protected]>
Cc: Tefft, Michael J <[email protected]>
Cc: [email protected]
Cc: Melanie Plageman <[email protected]>
Subject: Re: Capturing both IP address and hostname in the log
Date: Thu, 10 Apr 2025 09:35:23 -0700
Message-ID: <CAKFQuwZzsMDVFUAbuXJdeGibdDJZTGcVwcXAKc0MhERDe72OeQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <BN8PR04MB550874EE58EC715656C3D3D2D0B72@BN8PR04MB5508.namprd04.prod.outlook.com>
	<[email protected]>
	<[email protected]>

On Thu, Apr 10, 2025 at 9:00 AM Tom Lane <[email protected]> wrote:

> [ moving to -hackers ]
>
> Adrian Klaver <[email protected]> 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.
>

cross-posting to -hackers now that it is here.

v19 plans aside the existing wording is incorrect (just here, other places
correctly point out the either-or aspect of the output).

The wording really should be more like:

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index fea683cb49..c545fee6c9 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7614,10 +7614,11 @@ local0.*    /var/log/postgresql
       </term>
       <listitem>
        <para>
-        By default, connection log messages only show the IP address of the
-        connecting host. Turning this parameter on causes logging of the
-        host name as well.  Note that depending on your host name
resolution
-        setup this might impose a non-negligible performance penalty.
+        By default, for TCP/IP-originated connections, the identifier of
the host
+        making the connection is its IP address.  Turning this parameter
on tells
+        the system to record the resolved host name instead.  Note that
depending
+        on your host name resolution setup this might impose a
non-negligible
+        performance penalty.
         This parameter can only be set in the
<filename>postgresql.conf</filename>
         file or on the server command line.
        </para>


Both the connection logging routine and log_line_prefix %h / %r simply
report the "identifier of the host making the connection".

David J.


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Capturing both IP address and hostname in the log
  In-Reply-To: <CAKFQuwZzsMDVFUAbuXJdeGibdDJZTGcVwcXAKc0MhERDe72OeQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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