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 1mLKnr-0004rz-4Q for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Sep 2021 07:36:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mLKnp-0006S1-Qp for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Sep 2021 07:36:57 +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 1mLKnp-0006Rt-J7 for pgsql-hackers@lists.postgresql.org; Wed, 01 Sep 2021 07:36:57 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLKnn-0007C8-AH for pgsql-hackers@lists.postgresql.org; Wed, 01 Sep 2021 07:36:57 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id A9B1D32009AB; Wed, 1 Sep 2021 03:36:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 01 Sep 2021 03:36:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=fm3; bh=ctd7cKsdUGK4JZYKqaY60aNE+8WjSY2xUHjEg4Mgm 2E=; b=ks2GC9JpN3HtJq7k8wUgls9AzidTI1Y5sMaVhfHl43NzfXlA4OUGl8YuT hCfsSdrDCO7IuOUTlmfxU7ggyODoSzGNBrVqIvz9MYrG9jrpjLkQAeJmUFEtQYmq XffV/3JhrTy78GYgVZv9/5/oP7vBVVq50dMIFjvXYfjHq+25J+x9Lmrx3i7ViPwB R1NzHvlYgm1Os0+VFhiWc3V5kV9pWYj3dRrJO+Sq60zjrYP9JWEbRJN0LMdas+CT lZWV/mpXzn2OyIVkMXB7PJ1h0wGf2rmsiQsE0ESIBn1/t5mOzAMcdkmeM0QEcZC/ Fbrr2xb/05uKMTb7zt74iZGqRYo+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeehnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpefhfeelfeeuveduvdff heejtdejjefglefhtddvffehledutedugeeffedtffffjeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 03:36:51 -0400 (EDT) Subject: Re: Proposal: More structured logging To: Ronan Dunklau , pgsql-hackers@lists.postgresql.org References: <3207907.AWbSqkKDnR@aivenronan> From: Peter Eisentraut Message-ID: Date: Wed, 1 Sep 2021 09:36:50 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <3207907.AWbSqkKDnR@aivenronan> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 13.08.21 15:23, Ronan Dunklau wrote: > The logging system already captures a lot of information in the ErrorData. But > at present there is no way for a log message authors to include more metadata > about the log outside of the log message itself. For example, including the > extension name which can be useful for filtering / dispatching log messages. > This can be done in the log message itself, but that requires specialized > parsing in the log output. > > Even though among the available loggers in core, only the csv logger would be > able to make sense of it, I feel it would be beneficial to add a tagging system > to logs, by adding different (tag, value) combinations to a log entry, with an > API similar to what we do for other ErrorData fields: > > ereport(NOTICE, > (errmsg("My log message")), > (errtag("EMITTER", "MYEXTENSION")), > (errtag("MSG-ID", "%d", error_message_id)) > ); What are some more examples of where this could be used? The extension name could be added more or less automatically to ereport() calls. I don't know what the MSG-ID is supposed to be. Are there other use cases?