public inbox for [email protected]  
help / color / mirror / Atom feed
From: Junwang Zhao <[email protected]>
To: Paul Brindusa <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Log retention query
Date: Tue, 28 Jan 2025 20:19:28 +0800
Message-ID: <CAEG8a3+p5r3Mk4WPQKxTiExHNZXUfd3sTm1p9CpP9Fn3Jbf3JA@mail.gmail.com> (raw)
In-Reply-To: <CAFeSbqjnRXNZ72NdD+G6ScKKBTQXAxpMk=XyH1sPGs+L2atF_A@mail.gmail.com>
References: <CAFeSbqjnRXNZ72NdD+G6ScKKBTQXAxpMk=XyH1sPGs+L2atF_A@mail.gmail.com>

On Tue, Jan 28, 2025 at 5:57 PM Paul Brindusa <[email protected]> wrote:
>
> Good morning everyone,
>
> Before I get on with today's problem, I would like to say how much I appreciate this community and everything that you do for end users.
>
> In today's problem I would like to understand if the following lines in our 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 confused 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
> [email protected]
>


-- 
Regards
Junwang Zhao






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Log retention query
  In-Reply-To: <CAEG8a3+p5r3Mk4WPQKxTiExHNZXUfd3sTm1p9CpP9Fn3Jbf3JA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox