Re: Log Rotation

From: SOzcn <selahattinozcnma(at)gmail(dot)com>
To: sagar jadhav <sagarjdhv5(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Log Rotation
Date: 2023-12-13 07:25:17
Message-ID: CAJyV5AaG_4wnH-0GjHnLm6A-wot-X3uUSWy1bHkXOf6CepCLUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks for the response guys, yeah that works with the specific log file.
Have a nice day!

sagar jadhav <sagarjdhv5(at)gmail(dot)com>, 13 Ara 2023 Çar, 05:13 tarihinde şunu
yazdı:

> Hi,
> You can set "log_truncate_on_rotation" to "on" to truncate the log files
> if the log file name is same on rotation.
>
> Thanks,
> Sagar
>
> On Tue, Dec 12, 2023 at 9:41 PM 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'
>> log_rotation_age=1440
>> log_min_duration_statement = 5000
>> log_line_prefix = 'time=%t [%p]: db=%d,user=%u,app=%a,client=%h '
>> log_statement = 'none'
>> log_temp_files = 0
>> log_timezone = 'Europe/Istanbul'
>> log_hostname = on
>> log_min_messages = warning
>> log_min_error_statement = error
>> log_lock_waits = on
>>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message SOzcn 2023-12-13 11:27:06 Reindex concurrently
Previous Message Mahendra Singh 2023-12-13 04:52:35 Re: Setup HA in PostgreSQL 15?