Re: [Proposal] Adding Log File Capability to pg_createsubscriber

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: Gyan Sreejith <gyan.sreejith@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Euler Taveira <euler@eulerto.com>, "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Peter Smith <smithpb2250@gmail.com>
Date: 2026-01-20T12:55:09Z
Lists: pgsql-hackers
On Tue, 20 Jan 2026 at 06:28, Gyan Sreejith <gyan.sreejith@gmail.com> wrote:
>
> Thank you for all your input. I have attached the latest version of the patch that includes the changes proposed by Vignesh and Amit. Please let me know if you have any questions or suggestions.

1)  Currently you are creating directories like
specifiedlogdir_timestamp for each run, so it generates log
directories like:
logdir_2026-01-20-18-15-55.267510
logdir_2026-01-20-18-16-49.468882

Instead can you change it to specifiedlogdir/exec_timestamp1.
specifiedlogdir/exec_timestamp2, etc

+                               populate_timestamp(timestamp,
sizeof(timestamp));
+                               log_dir = psprintf("%s_%s", optarg, timestamp);
+                               opt.log_dir = pg_strdup(log_dir);
+                               canonicalize_path(opt.log_dir);
+
+                               if (stat(opt.log_dir, &statbuf) != 0)
+                               {
+                                       if (errno == ENOENT)
+                                       {
+                                               mkdir(opt.log_dir, S_IRWXU);


2) Your patch is based on a slightly older code, it does not apply on
HEAD, Kindly rebase your patch on top of HEAD,

Regards,
Vignesh



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pg_createsubscriber: Don't use MAXPGPATH

  2. pg_createsubscriber: Remove separate logfile_open() function

  3. pg_createsubscriber: Use logging.c log file callback

  4. Add log file support to logging.c

  5. pg_createsubscriber: Add -l/--logdir option to redirect output to files.

  6. pg_createsubscriber: Introduce module-specific logging functions.

  7. Fix another buglet in archive_waldump.c.