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 1tFcKF-00ELRf-Au for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Nov 2024 16:52:39 +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 1tFcKD-00GYeM-Sx for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Nov 2024 16:52:37 +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 1tFcKD-00GYeD-Ih for pgsql-hackers@lists.postgresql.org; Mon, 25 Nov 2024 16:52:37 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tFcK7-003naR-07 for pgsql-hackers@lists.postgresql.org; Mon, 25 Nov 2024 16:52:36 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2fb59652cb9so49725531fa.3 for ; Mon, 25 Nov 2024 08:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732553550; x=1733158350; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FcgO9brav0HQs+BtF9e4NhwC2/7ua2Z03kf4juJsZb0=; b=hs+WjU04foSPwx9WT8bg/4m109TvmSowE9JYa2ae4wf31UHqlOFEJCBKUFRLoQgE7A 6hTvZMVNsM7jgmsojfjnNuAS0j49G/XRsX05ortGK05Xd9DvDMHfvv/y6Uea4d+LAwFU qpqoFgCupXzrsznQRO+OwU61n4elff9KmF3Rtq69w3GmWyALr3D3F9GBIoTVuj40Kpa0 I27MPJRTjAeX46rPyoyOARYRKvdcrZc54sEJUZe3kvHwlZoosyRWsNWnotYyoBoEKPHq tjZT0cSTTQ9mZgguW7beKHyaO96xCXOTwxIG2UEseor/b5ZOzP9RNEda9kY5A9382Bse hoAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732553550; x=1733158350; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FcgO9brav0HQs+BtF9e4NhwC2/7ua2Z03kf4juJsZb0=; b=M4tlyzXp2CZTyVAGdPfvtyQ2ZlHWzUj5I7Bt/g0VZoi/2ri13fUsVGuMac7SuqGeve Xae96XTYF7ZUJ/EGm2nLe4B8EKsk5OSJBSgetQS8JiL7iRwr2wmtwzYc0XuFlAViZr1p 1wSmBbD1kCsh4Oaim8Bs7vvVYvDs+6QJs8by77KIwUqIX9TAeml/OscJXraufIGOR2QB 4ob2mM4z9MiBlz1Fs77vCgMRvorXgt+Zdjahrl2Ny6Hk1b6BNlSrn0vQh9B7A37ymuHr IBH1DcXYopCmyV9S8tEJvRM14lGmq8pTsf22dVsFRkPmgM9koMDdgJfN3wnqcLKivAya Q4hA== X-Forwarded-Encrypted: i=1; AJvYcCXG2WniixgEquzcMHU/YfAQD3mtHl7iOLe2IpLCh6/wl8hfKMRS412hviX+FrQSP1m7AjeCLjdHDxAuwxSF@lists.postgresql.org X-Gm-Message-State: AOJu0Yzaxkpq++6efmZGWI8PwDaeXxF2BcXW/ZgSaS3l9a9WYFLc68QR b4a4L6Tjtd240IlATUyXszQtEnMWtAP1TMzZP3CJLG2QdiYceTS0mKo8USqaUoegk4FD0m7CPU0 3KDBeGqYDQCLiJGRxKXX4oHE0IGw= X-Gm-Gg: ASbGncsx+qNbJLxr4pVW4k62EfYfFMAKHxbNXTmVI3YliXue3glYOGwV1HMKZ9ezml8 IrVUW44fpmUaqWLJNnddwoHJm7kHW X-Google-Smtp-Source: AGHT+IEuHG65aV9GLsADEqHqdcGMT20Dm4K8MrRlbWhKbx5tlDht4yI6FNIEUF0YtPhgDIhmYrF2/uaDLohUFZbkeIk= X-Received: by 2002:a05:651c:2114:b0:2ff:c67f:51bf with SMTP id 38308e7fff4ca-2ffc67f547dmr16305661fa.18.1732553548715; Mon, 25 Nov 2024 08:52:28 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Kirill Reshke Date: Mon, 25 Nov 2024 21:52:17 +0500 Message-ID: Subject: Re: Truncate logs by max_log_size To: Kirill Gavrilov Cc: Jim Jones , "Andrey M. Borodin" , Euler Taveira , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 1 Oct 2024 at 20:46, Kirill Gavrilov wrote: > > On Tue, Oct 1, 2024 at 2:46=E2=80=AFPM Jim Jones wrote: >> >> >> On 27.09.24 12:36, Andrey M. Borodin wrote: >> > Consider max_log_size =3D 10Mb. The perspective might look very differ= ent. >> > It=E2=80=99s not about WHERE anymore. It's a guard against heavy abus= e. >> > >> > The feature looks very important for me. >> I have the same opinion. As a fail safe it sounds very useful to me. >> >> Unfortunately, the patch does not apply: >> >> $ git apply >> ~/patches/max_log_query/0001-parameter-max_log_size-to-truncate-logs.pat= ch >> -v >> Checking patch src/backend/utils/error/elog.c... >> error: while searching for: >> char *Log_destination_string =3D NULL; >> bool syslog_sequence_numbers =3D true; >> bool syslog_split_messages =3D true; >> >> /* Processed form of backtrace_symbols GUC */ >> static char *backtrace_symbol_list; >> >> error: patch failed: src/backend/utils/error/elog.c:114 >> error: src/backend/utils/error/elog.c: patch does not apply >> Checking patch src/backend/utils/misc/guc_tables.c... >> Hunk #1 succeeded at 3714 (offset 247 lines). >> Checking patch src/backend/utils/misc/postgresql.conf.sample... >> Hunk #1 succeeded at 615 (offset 23 lines). >> Checking patch src/bin/pg_ctl/t/004_logrotate.pl... >> error: while searching for: >> check_log_pattern('csvlog', $new_current_logfiles, 'syntax error', $nod= e); >> check_log_pattern('jsonlog', $new_current_logfiles, 'syntax error', $nod= e); >> >> $node->stop(); >> >> done_testing(); >> >> error: patch failed: src/bin/pg_ctl/t/004_logrotate.pl:135 >> error: src/bin/pg_ctl/t/004_logrotate.pl: patch does not apply >> Checking patch src/include/utils/elog.h... >> Hunk #1 succeeded at 502 (offset 1 line). >> >> Does it truncate only single queries or also a transaction with many >> statements? >> >> Thanks! >> >> Best, Jim > > > My apologies, attached patch should work on master branch. > It truncates single queries and a statement in transaction that occurred = an error. > Hello! Please deliver the most recent patch version and fix the issues Jim identified [0] as the current commitfest draws to a close. Do not forget to include both parts of this patch (This was actually developed off-list, and we are now using this on our cloud PostgreSQL distribution on versions 12=E2=80=9317). [0] https://www.postgresql.org/message-id/35096a36-04d4-480b-a7cd-a2d8151fb= 737%40uni-muenster.de --=20 Best regards, Kirill Reshke