Re: Log retention query - Mailing list pgsql-general

From Paul Brindusa
Subject Re: Log retention query
Date
Msg-id 147245a5-5105-4cf1-85cf-bb92176b9702@gmail.com
Whole thread Raw
In response to Log retention query  (Paul Brindusa <paulbrindusa88@gmail.com>)
List pgsql-general
I am defo sure that my syntax was fine.

I have tried the same syntax to remove the logs manually from the 
folder  and it worked perfectly.

The cronjob was set from root, so I am assuming it has the right 
privileges over the folder in cause.


@ Adrian the cluster runs on Rocky9

There is no error from cron that is the weird bit as well.

I do not have MAILTO set up on cron.

Regards,

Paul

On 02/02/2025 19:57, Peter J. Holzer wrote:
> On 2025-02-02 12:12:07 +0000, Paul Brindusa wrote:
>> I had the exact same query as Junwang proposed.
> Assuming that by "query" you mean the crontab entry:
>
> Well, if if was *exactly* the same it's unlikely to work since you
> probably don't have a directory literally called "/path/to/logs". If you
> made the obvious substitution, it should work provided it runs with
> appropriate privileges.
>
> What is the output if you remove the «-exec rm {} \;» bit? What happens
> if you reduce the mtime?
>
>
>> Was mega upset that I could not get the cronjobs to work, and from what I
>> can tell from @Laurenz's  response above we have the names of the logs
>> customised to posgtres-%d-%m-%y.
> Earlier you wrote that the pattern was actually
> «postgresql-%Y-%m-%d.log». «find ... -name "*.log"» would find that but
> of course not «posgtres-%d-%m-%y».
>
>          hp
>



pgsql-general by date:

Previous
From: Shaheed Haque
Date:
Subject: Idempotent CREATE SUBSCRIPTION and DROP SUBSCRIPTION pair
Next
From: Marcelo Fernandes
Date:
Subject: Logging queries executed by SPI_execute