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 1tckZF-002O77-2m for pgsql-general@arkaria.postgresql.org; Tue, 28 Jan 2025 12:19:45 +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 1tckZE-000sip-5m for pgsql-general@arkaria.postgresql.org; Tue, 28 Jan 2025 12:19:44 +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 1tckZD-000sid-RV for pgsql-general@lists.postgresql.org; Tue, 28 Jan 2025 12:19:43 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tckZB-001w70-2k for pgsql-general@postgresql.org; Tue, 28 Jan 2025 12:19:42 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5d0ac27b412so7304402a12.1 for ; Tue, 28 Jan 2025 04:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738066781; x=1738671581; darn=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=RHrR7xdy7ZjU0RJOhE7JnaosPblGMsy7ez1a7ANedDo=; b=V4k4uUPqpPwdM+biscljFHXTtd9XF+mt0NBwe1lwpDp1wxkQdrFfE0+f3vIxGNDgGB 7buBcklBkkp+mYJLhxK1C4HQ+P9JBwqoWeVmWJbNuOQP40MM/HrHilfWQua/w7LIUAW7 h5hOk+5COAP1gQ0Yfoe4QMfg0i/9jWpNHeUxuvte8FaNXmldg4SG6K9K4/UJ+v5L1w85 8+9Efy0mlskG4gP9Ou0vOTwH4PnaIMFVZoKaG/hdu/YYR8gLAmbIFvXsdKGgDDnBnvjN qO4bJvxxWhx+uaKlA6E9Z8q55TX0howOXg6OPiFJRWCuKAb8U7mSPls/rt1z6mNuJd2Q qRBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738066781; x=1738671581; 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=RHrR7xdy7ZjU0RJOhE7JnaosPblGMsy7ez1a7ANedDo=; b=uivInbbxOrEA1GihPbc/8EhfqhyzLslAATa+LKM4zSi9OWy41mL27SUrvoCgucHi2A R8M0quPCQ1cVjxkgsWnn4mFvst0FfKsRXyU+Nsxccs0LCgPF28LBRx6iuM8H08gWF93x CaGFDGvmU/q2IpF2SU2mBxVT3eOQfWLmGJPndafdZoEzGWqb9zpZZqL6kzcJSJgkT/7p w7mQYQTpXL/1lJ8jlshd0mNGdcuByXqPr9p0GNeVelYgTw7tcPOmoiWNPTYynl+7eGuM zYmcfFm9G5O2NWhln2RabKNY5WPxqYuDbpLdyUHsD9NBRkIT2jS0L3moKnZes5eMOvHC 7rqg== X-Gm-Message-State: AOJu0YwyhihuLaLiC549GeN2quOOpGRL6YUHqS0d57xsNL4GDhIAQ9qX m0GloMh2ikf+7rCxrpBDQxmwhHFrlR8jGOoTVpXi6lCRqvKFc8sJknNGHpQek01ctv1wi/HRbYq w/K/SIplxTsz7+65Udn8IlcHn30esxESTc7Mj7g== X-Gm-Gg: ASbGncueceYwak707xPaPyJKqfLqE8w04rn7FWT4nTAtlAWP4lip05I7Qvdvn+7+seR jLM9I2fGjyiS9iLSRdBJP8KECTHnA1PPBj4gOfyAcJCz1E3gFwXkV/+K5p9YNUKJJFP29R74= X-Google-Smtp-Source: AGHT+IFWHzt/A1MnirRKtOKNbukOKkgxftrJL/zHdQ/HRo7Gey6/YsAGhXIFP1pyeBW/az5oNnL55qKCKJjQTrX+Imw= X-Received: by 2002:a05:6402:51c9:b0:5d9:a54:f8b4 with SMTP id 4fb4d7f45d1cf-5db7d2f88b1mr44301845a12.11.1738066780546; Tue, 28 Jan 2025 04:19:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Junwang Zhao Date: Tue, 28 Jan 2025 20:19:28 +0800 X-Gm-Features: AWEUYZlEpUBd6iKbxkfvZyP33TMIQ7v8gUkIT9mUNHzZeZ-2jP0UcFuAapDh_fg Message-ID: Subject: Re: Log retention query To: Paul Brindusa Cc: pgsql-general 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, Jan 28, 2025 at 5:57=E2=80=AFPM Paul Brindusa wrote: > > Good morning everyone, > > Before I get on with today's problem, I would like to say how much I appr= eciate this community and everything that you do for end users. > > In today's problem I would like to understand if the following lines in o= ur config handle the log rotation for our clusters? > > log_checkpoints: on > logging_collector: on > log_truncate_on_rotation: on > log_rotation_age: 1d > log_rotation_size: 1GB > log_error_verbosity: verbose > > I have been deleting the logs manually for the last month, since I am con= fused how the log collector rotates them. > > Am looking to delete logs older than 180 days. What are we doing wrong in= the config? I doubt Postgres can do this, but you can do this by adding a crontab entry. e.g. 0 2 * * * find /path/to/logs -type f -mtime +180 -name "*.log" -exec rm {} = \; > > -- > Kind Regards, > Paul Brindusa > paulbrindusa88@gmail.com > --=20 Regards Junwang Zhao