Re: Proposal: Save user's original authenticated identity for logging

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jacob Champion <pchampion(at)vmware(dot)com>
Cc: "magnus(at)hagander(dot)net" <magnus(at)hagander(dot)net>, "stark(at)mit(dot)edu" <stark(at)mit(dot)edu>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "sfrost(at)snowman(dot)net" <sfrost(at)snowman(dot)net>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Proposal: Save user's original authenticated identity for logging
Date: 2021-03-18 08:14:24
Message-ID: YFML4MDZVWWuIBTF@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 15, 2021 at 03:50:48PM +0000, Jacob Champion wrote:
> # might need to retry if logging collector process is slow...
> my $max_attempts = 180 * 10;
> my $first_logfile;
> for (my $attempts = 0; $attempts < $max_attempts; $attempts++)
> {
> $first_logfile = slurp_file($node->data_dir . '/' . $lfname);
> - last if $first_logfile =~ m/\Q$expect_log_msg\E/;
> +
> + # Don't include previously matched text in the search.
> + $first_logfile = substr $first_logfile, $current_log_position;
> + if ($first_logfile =~ m/\Q$expect_log_msg\E/g)
> + {
> + $current_log_position += pos($first_logfile);
> + last;
> + }
> +
> usleep(100_000);

Looking at 0001, I am not much a fan of relying on the position of the
matching pattern in the log file. Instead of relying on the logging
collector and one single file, why not just changing the generation of
the logfile and rely on the output of stderr by restarting the server?
That means less tests, no need to wait for the logging collector to do
its business, and it solves your problem. Please see the idea with
the patch attached. Thoughts?
--
Michael

Attachment Content-Type Size
krb5-tap-simplify.patch text/x-diff 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-03-18 08:28:38 Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch
Previous Message Kyotaro Horiguchi 2021-03-18 07:56:02 Re: shared-memory based stats collector