Limiting the no. of logs file generated by postgreSQL

Поиск
Список
Период
Сортировка
От merina ghoghwani
Тема Limiting the no. of logs file generated by postgreSQL
Дата
Msg-id CAKoQ0XHAy9De1C8gxUWHSW6w5iKcqX03wyWGe_+c8NxJccCBHw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Limiting the no. of logs file generated by postgreSQL  (pavan95 <pavan.postgresdba@gmail.com>)
Re: Limiting the no. of logs file generated by postgreSQL  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-admin
Hi All,

I am currently using PostgreSQL 9.4.5. 

In one scenario with heavy traffic, log file size increased to 100GB in a day, and due to which system ran out of disk space. The configuration in postgresql.conf for log file was:

log_filename = 'postgresql-%a.log'

So, I want the log files to rotate such that the, 
1. Total size of the Postgres logs is always less than 700MB.
2. I want to maintain recent 5 log files of 20MB each in a day .i.e. Total 100MB/day. 

So I have tried only log_rotation_size option as below in configuration file, but it didn't work for me.

log_rotation_size = '10kB' /* The file is not rotated after size increases over 10KB. */

When I tried logging with the following configuration (just to test, the values are pretty low):

log_rotation_size = '10kB'
log_filename = 'postgresql-%Y-%m-%d_%M.log'
log_truncate_on_rotation = 'on'
log_rotation_age = '10'

What I've observed is, 
1. I get a new file after every 10 Mins or when I restart the service or logs size is over 10KB. 

But, it doesn't solve my problem to reduce the size of postgres logs, as the file is not rotated, but a new is created every time.

Is there any way I can rotate the files or restrict number to, say max 5 files
like,
postgresql-Mon-1.log
postgresql-Mon-2.log
postgresql-Mon-3.log
postgresql-Mon-4.log
postgresql-Mon-5.log

and then re-write to "postgresql-Mon-1.log" file.

Regards,
Merina

В списке pgsql-admin по дате отправления:

Предыдущее
От: Shreeyansh Dba
Дата:
Сообщение: Re: filter partitions
Следующее
От: pavan95
Дата:
Сообщение: Re: Limiting the no. of logs file generated by postgreSQL