public inbox for [email protected]  
help / color / mirror / Atom feed
From: Paul Brindusa <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Log retention query
Date: Tue, 28 Jan 2025 13:40:42 +0000
Message-ID: <CAFeSbqjqi1DZjQDatiZehk3GpkX_dFv=qgfsgWxKbsACSWJv_g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAFeSbqjnRXNZ72NdD+G6ScKKBTQXAxpMk=XyH1sPGs+L2atF_A@mail.gmail.com>
	<[email protected]>

@Junwang apologies, I should have mentioned that  we've tried setting up a
crontab and it has not worked. Have you got something similar working?

@Laurenz: log_filename: postgresql-%Y-%m-%d.log  -- if we redo the syntax
can we make it trigger garbage collection on 180 days?

On Tue, Jan 28, 2025 at 1:28 PM Laurenz Albe <[email protected]>
wrote:

> On Tue, 2025-01-28 at 09:57 +0000, Paul Brindusa 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?
>
> It all depends on how you configured "log_filename".
>
> If the setting is "postgresql-%a.log" or "postgresql-%d.log", PostgreSQL
> will recycle the old log files once a week or once a month.
>
> If the setting is the default "postgresql-%Y-%m-%d_%H%M%S.log", the same
> log file name will never be reused, and there will be no log rotation.
>
> PostgreSQL doesn't actively delete old log files.
>
> Yours,
> Laurenz Albe
>


-- 
Kind Regards,
Paul Brindusa
[email protected]


view thread (13+ messages)  latest in thread

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: <CAFeSbqjqi1DZjQDatiZehk3GpkX_dFv=qgfsgWxKbsACSWJv_g@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