Re: Capturing both IP address and hostname in the log - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Capturing both IP address and hostname in the log
Date
Msg-id 525679.1744300832@sss.pgh.pa.us
Whole thread Raw
Responses Re: Capturing both IP address and hostname in the log
List pgsql-hackers
[ moving to -hackers ]

Adrian Klaver <adrian.klaver@aklaver.com> 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



pgsql-hackers by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Correct documentation for protocol version
Next
From: Robert Haas
Date:
Subject: Re: Add missing PGDLLIMPORT markings