Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMnnz-0005H8-Pv for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Mar 2021 08:14:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lMnnx-0004Dn-A3 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Mar 2021 08:14:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMnnv-0004BS-PD for pgsql-hackers@lists.postgresql.org; Thu, 18 Mar 2021 08:14:53 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMnnn-0005Ik-R6 for pgsql-hackers@postgresql.org; Thu, 18 Mar 2021 08:14:51 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 2D4925C007B; Thu, 18 Mar 2021 04:14:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 18 Mar 2021 04:14:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=Yhy/4YEiQXCcKCnjrpm0hbMM1gu VA66ONi3hTKejVlA=; b=UHMa5dRlt4G1yH3AdguSxcQPUg1mfUvKrRxyDNTj5mI aHbgYYCaquTYgpVf7ZH+vRXzUPL2f45yjD99dTpFl5s6FvNkNf3X6qtVs2FVGuKK dLexzNw5RCsLAOkyTh/4n3/quOjNwgKHSxKNeqqfWZ+Bf6K52GbfU3xIaTY9p6mh o6BCzL/ze8hWt4vVq0zQpNOwxMMTeyYPOutbEYJJ+fZOKskAm6LR8xypVORophGG rEttNwtUN42xuTiL9377g2m2EzVu67aikDfdGK8eOfdBzqXxIMfN4iXYQd2dLjew BqY3FWRJAOVb75hZv86um5zmGYadwuFMn/ziax1eTdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Yhy/4Y EiQXCcKCnjrpm0hbMM1guVA66ONi3hTKejVlA=; b=VkaSfPvHr6HEKH8xLrvx4F dkfs1qMTjgIbfr4Oa6XQq+lL7kT4euMu+M2szvOz9MLcmt2pdiU2GKx8da5De4OW wSs7p4lP/w8Sx1fgFAjf5qrrNgHo6/3rwPKf8YVbNjiFWgwDODCqcWklEqngTZBQ lHHh39N7EXQKbQKS4KaDHXIQj6zng6qgVYwIEZK4Ty5ZyomZIPRg9LA+PrWx6ie4 Zchfb+BUid95I2EnpWR26PoefcOVbGWMFW1wU6uLo7IvTQMqcEYtAPdqFlArU30W yVMB3sz1ZwfehcH5n6dcWCW69KL7uWn3Z6vlCZC8mNntXcm2fyXsBNGE6IfTOwHA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudefhedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveej heehieevueeigeelteegleejleeiueeiheegvefhnecukfhppeduuddurddutddvrdduke dtrddukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 2D60824005B; Thu, 18 Mar 2021 04:14:28 -0400 (EDT) Date: Thu, 18 Mar 2021 17:14:24 +0900 From: Michael Paquier To: Jacob Champion Cc: "magnus@hagander.net" , "stark@mit.edu" , "pgsql-hackers@postgresql.org" , "sfrost@snowman.net" , "tgl@sss.pgh.pa.us" Subject: Re: Proposal: Save user's original authenticated identity for logging Message-ID: References: <5d8b74e64fe4a610b23624277e497cc0a925db4b.camel@vmware.com> <2870147caa759155c5c8a232bbd2399f41f76491.camel@vmware.com> <4b2ca51542fa84e6fa37ab678624d5b400c092c0.camel@vmware.com> <679382aaff23627a2e53541322c7a3158d402394.camel@vmware.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RjmICSHfvdlTFxGo" Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --RjmICSHfvdlTFxGo Content-Type: multipart/mixed; boundary="TQIH4/AXD+HH+iQ9" Content-Disposition: inline --TQIH4/AXD+HH+iQ9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --TQIH4/AXD+HH+iQ9 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="krb5-tap-simplify.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth= =2Epl index 079321bbfc..aca673e97a 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -20,7 +20,7 @@ use Time::HiRes qw(usleep); =20 if ($ENV{with_gssapi} eq 'yes') { - plan tests =3D> 34; + plan tests =3D> 26; } else { @@ -170,7 +170,6 @@ $node->append_conf( 'postgresql.conf', qq{ listen_addresses =3D '$hostaddr' krb_server_keyfile =3D '$keytab' -logging_collector =3D on log_connections =3D on # these ensure stability of test results: log_rotation_age =3D 0 @@ -212,27 +211,13 @@ sub test_access # Verify specified log message is logged in the log file. if ($expect_log_msg ne '') { - my $current_logfiles =3D slurp_file($node->data_dir . '/current_logfiles= '); - note "current_logfiles =3D $current_logfiles"; - like($current_logfiles, qr|^stderr log/postgresql-.*log$|, - 'current_logfiles is sane'); - - my $lfname =3D $current_logfiles; - $lfname =3D~ s/^stderr //; - chomp $lfname; - - # might need to retry if logging collector process is slow... - my $max_attempts =3D 180 * 10; - my $first_logfile; - for (my $attempts =3D 0; $attempts < $max_attempts; $attempts++) - { - $first_logfile =3D slurp_file($node->data_dir . '/' . $lfname); - last if $first_logfile =3D~ m/\Q$expect_log_msg\E/; - usleep(100_000); - } - + my $first_logfile =3D slurp_file($node->logfile); like($first_logfile, qr/\Q$expect_log_msg\E/, - 'found expected log file content'); + 'found expected log file content'); + + # Rotate to a new file, for any follow-up check. + $node->rotate_logfile; + $node->restart; } =20 return; --TQIH4/AXD+HH+iQ9-- --RjmICSHfvdlTFxGo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmBTC+AACgkQnvQgOdby QH3zWg/+IOm0uE6Y8q60c2K/q3iXfU8QAIlUK7wbqdl2S0z/4BtaMfctETnETCMf lbk1C3Yccfu4crp8arvKrLUibv5nNWfmsKVXbMUA/g0eOD5/0/fxL1fdxmzKtrSW hzYYMyPyTRyhQlQrOrKdYes0YRDFb+MPEqp4Av/Le/82to1L28Lz8S9J6oABlPCZ 1JHRhCtHR0ShteNs+EaDQwedujE4U41RwvGJ91DPNlkcNf0lU2FJVvbAHqhAWkGp 14mwQRLalRytAHkBU5iX8ght8Q4SeO5pV3QFbaEYV1ehExSfNWY7oaQ9CrOOq18Z OFn7pRL3qA8FaG3GKh6bhPnRkpgINHoMN2ZgcRIUXcWRS1H3p+AKQCJY8O9syEmu GchB2Q4IdoPK4rCSZWD6YrHh/k03ttqNie8lc6WnDMlaTSo0+X8eWvOGOgV7Nuyw TcNGwIcFk9OhHsJk78cCLt35T1sx7OYfTqGD0dg9NvwhZ68rTWIAuI1VY8bONNs+ SwQCE02iooVBSPjROIS4Ofk9/pLQuYqI+bunBMzIxFYNqD/q1VHJWy8ku3Bfowqi 7K9Rbn2aZMZRmDF+RNaaAO1f5HE4o+iT49Wli/nPNtPfj3r9eVk3LYZLi/+egcLg VPYxUD4qzZDFClljk0pC5tMjjU7iUwIkXfp4ctT1RXEt7Hxg7mU= =HBH2 -----END PGP SIGNATURE----- --RjmICSHfvdlTFxGo--