Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tH6QF-003S7i-Q7 for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Nov 2024 19:13:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tH6QB-009uYN-20 for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Nov 2024 19:12:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tH6QA-009uYF-Kw for pgsql-hackers@lists.postgresql.org; Fri, 29 Nov 2024 19:12:55 +0000 Received: from udcm-wwu1.uni-muenster.de ([128.176.118.7]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tH6Q4-000C5Q-Ro for pgsql-hackers@lists.postgresql.org; Fri, 29 Nov 2024 19:12:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-muenster.de; i=@uni-muenster.de; q=dns/txt; s=uniout; t=1732907570; x=1764443570; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=DuN1Uea8YnqezrAebsEvFAglSWFeoNK2ebqSa5NoES4=; b=ClZUbHXqM1OGNmxHt3rC1fyiJOFOOWYPKpxWaNX99r+3AGLdS4Uh9hLl EZdsxC71C9RR6RnDTKXPdSgQ7T+bPgI22LYhn6Eqvc0cwECK/37pY0hJT bW4hnO7CNzMXTft95ia7AdcCM/2F7ST512zO9O9PaAluvZdyeZU51TAyo Rp521TMC7pLlMQzcIoo0LxYBoLwsfOKp0SPiH2xo3JSVeilpe/y6cYKt2 LhR10Cq6SiDQ7DU/Aska4moLo/AETdZG07ItIk9lYJ1r1/OQjl3pSGA80 nov7zQIZYpJS06V6+YQ6PBsIvyLjDuxfXjBnWskeUEt6e8TUcabbTm48V Q==; X-CSE-ConnectionGUID: H/Ca1H5ITgCU0hqQEbZOkA== X-CSE-MsgGUID: mudm3uptTKS2l//hGNEhhg== X-IronPort-AV: E=Sophos;i="6.12,196,1728943200"; d="scan'208";a="350139190" Received: from secmail.uni-muenster.de ([128.176.118.4]) by UDCM-RELAY1.UNI-MUENSTER.DE with ESMTP; 29 Nov 2024 20:12:48 +0100 Received: from [192.168.178.27] (unknown [78.48.246.137]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id 5372C20ADF00; Fri, 29 Nov 2024 20:12:46 +0100 (CET) Message-ID: <3f1b817f-6e7a-4e01-bfc5-50ea3724225e@uni-muenster.de> Date: Fri, 29 Nov 2024 20:12:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Truncate logs by max_log_size To: Kirill Gavrilov Cc: Kirill Reshke , "Andrey M. Borodin" , Euler Taveira , pgsql-hackers@lists.postgresql.org References: <94d53a41-d1f5-4fd1-8d1e-ff36ac569848@app.fastmail.com> <4DA5A159-39FD-47DB-95E5-A4F65BC5782A@yandex-team.ru> <53e96b5a-cc77-4afa-8103-79c69afef1a6@uni-muenster.de> <748a7ec0-9126-4f27-a2a7-e3e449d6fdd7@uni-muenster.de> <8a240667-de9e-455b-b3e2-62f34ec80154@uni-muenster.de> Content-Language: en-US From: Jim Jones In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 29.11.24 12:05, Kirill Gavrilov wrote: >   Setting max_log_size to 0 already disables truncation. >   I changed guc units to bytes, just to make it more human-friendly. > Did some refactoring and fixed all warnings. Set default value in > postgresql.conf. Nice. The patch applies cleanly and the warnings are gone. A few other things: IMHO the documentation can be a bit clearer. It says to input the values in bytes, but the default value is in megabytes. +        If greater than zero, each query logged is truncated to this many bytes. +        Zero disables the setting. +        Default value is 5MB. Perhaps something like "If this value is specified without units, it is taken as bytes." (see wal_keep_size) And a pedantic note: This hint suggests that you can use TB as unit .. postgres=# set max_log_size = '1foo'; ERROR:  invalid value for parameter "max_log_size": "1foo" HINT:  Valid units for this parameter are "B", "kB", "MB", "GB", and "TB". .. but it can never be used, as it exceeds the integer range: postgres=# SET max_log_size = '1TB'; ERROR:  invalid value for parameter "max_log_size": "1TB" HINT:  Value exceeds integer range. Thanks -- Jim