Re: Capturing both IP address and hostname in the log

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "Tefft, Michael J" <Michael(dot)J(dot)Tefft(at)snapon(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Capturing both IP address and hostname in the log
Date: 2025-05-20 15:48:13
Message-ID: CAAKRu_ZWKOWCfxsg_nthFusiax9OOiOa8bmCsh06F6QSZ_W5FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thu, Apr 10, 2025 at 12:00 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> 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.)

Seems reasonable to me. I'd be willing to move such a thing forward but
would want to see the feature requestors' specific desired behavior (e.g.
an option for each of hostname, client ip address, and server address?).
Also, if they write a WIP patch at least to config.sgml, it would also help
me gauge how serious of a request it is or, rather, how satisfactory a
solution a log_connections option is.

Perhaps there are people who absolutely love log_hostname and don't want to
see it deprecated as a separate GUC?

I also think folding in log_disconnections as a "disconnection" option
makes sense. I do have some anxiety that a very long list of options will
anger users -- but I suppose that ship mostly sailed.

- Melanie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tessa Niebel 2025-05-20 18:06:33 Postgres query tool not working when I right click
Previous Message Moreno Andreo 2025-05-20 11:12:42 Re: Logical replication, need to reclaim big disk space

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-05-20 15:54:31 Re: Violation of principle that plan trees are read-only
Previous Message Bruce Momjian 2025-05-20 15:47:56 Re: Suggestion: Update Copyright Year to 2025 in Recently Added Files