Re: Log Rotation

From: SOzcn <selahattinozcnma(at)gmail(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Log Rotation
Date: 2023-12-12 16:52:16
Message-ID: CAJyV5AYhv2dKs-g3B=Cq+eumfiaid1DnMN+s_SKkAhi0bXQYQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks for the response Ron!
Have a great week!

Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, 12 Ara 2023 Sal, 19:48 tarihinde
şunu yazdı:

> On Tue, Dec 12, 2023 at 11:11 AM SOzcn <selahattinozcnma(at)gmail(dot)com> wrote:
>
>> Hello team I hope everything going well for you guys!
>>
>> I have a question about log rotation.
>>
>> 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.
>>
>> The parameter for I used as Hour log; postgresql-%H%M
>>
>> log_destination = 'stderr'
>> logging_collector = on
>> log_directory = '/var/log/postgresql/logtest'
>> log_filename = 'postgresqllogtest-%Y-%m-%d_%H%M%S.log'
>>
>
> %M%S really isn't needed.
>
>
>> log_rotation_age=1440
>>
>
> (Setting that to "1d" is clearer IMO than 1440 minutes.)
>
> It _says_ "rotation", but _means_ "overwrite".
>
> If you want to _delete_ files older than 12 days, you must have an
> external process do it: logrotate, or your own shell script that uses
> find(1).
> https://unix.stackexchange.com/questions/459996/deleting-older-log-files
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2023-12-12 22:48:33 Re: Log Rotation
Previous Message Ron Johnson 2023-12-12 16:48:26 Re: Log Rotation