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 1rD5ST-000rPt-RT for pgsql-admin@arkaria.postgresql.org; Tue, 12 Dec 2023 16:18:09 +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 1rD5SS-006OHP-6K for pgsql-admin@arkaria.postgresql.org; Tue, 12 Dec 2023 16:18:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rD5SR-006OHC-Qz for pgsql-admin@lists.postgresql.org; Tue, 12 Dec 2023 16:18:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rD5SP-00A3cW-Ey for pgsql-admin@lists.postgresql.org; Tue, 12 Dec 2023 16:18:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BCGI2g22444343; Tue, 12 Dec 2023 11:18:03 -0500 From: Tom Lane To: SOzcn cc: Pgsql-admin Subject: Re: Log Rotation In-reply-to: References: Comments: In-reply-to SOzcn message dated "Tue, 12 Dec 2023 19:11:12 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2444341.1702397882.1@sss.pgh.pa.us> Date: Tue, 12 Dec 2023 11:18:02 -0500 Message-ID: <2444342.1702397882@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk SOzcn writes: > I set the parameters as a daily. The set parameters are as follows. > In this case, the log file is created as > "postgresqllogtest-2023-12-12_182351.log" after the 13th day file, the logs > in the 12th day file need to be truncated. > Is the expected result correct? Or does PostgreSQL not support deleting, > truncating files? I got successful results when I did this process hourly. > However, I could not get a correct result when I tried it daily log > truncate. If you want log rotation, you need to choose your filename pattern so that old log files will be overwritten after a while; or else set up some external tool for removing the old ones. Postgres does not do anything to keep track of old log files. regards, tom lane