Re: Logging which local address was connected to in log_line_prefix

Greg Sabino Mullane <htamfids@gmail.com>

From: Greg Sabino Mullane <htamfids@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jim Jones <jim.jones@uni-muenster.de>, david@pgmasters.net, Peter Eisentraut <peter@eisentraut.org>, Cary Huang <cary.huang@highgo.ca>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-26T17:14:43Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add local-address escape "%L" to log_line_prefix.

Attachments

Thanks for all the feedback. Please find attached a version which prints
"[none]" as the default value, "[local]" for a socket, and otherwise
whatever pg_getnameinfo_all spits out. I cleaned up the coding, respected
padding, removed the family checks, and expanded the docs a tiny bit to
give the reader more context as to what "local address" means. I also
looked into alternatives to the term "local address" but that still seems
the most correct and commonly used term.

I have not attempted the caching change yet.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support