Re: Limiting the size of log files

Поиск
Список
Период
Сортировка
От Amit Soni
Тема Re: Limiting the size of log files
Дата
Msg-id AANLkTinLzBg4BBx25q2Xq-PZJLquaMyWOi36H8RnGHWZ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Limiting the size of log files  (Thom Brown <thom@linux.com>)
Ответы Re: Limiting the size of log files  (Thom Brown <thom@linux.com>)
Re: Limiting the size of log files  ("Jean-Yves F. Barbier" <12ukwn@gmail.com>)
Список pgsql-novice
Sorry for not stating this earlier. It's possible for me to have ~20GB of logs in one day. So, per day rotation is not the best option here. And since limiting the size of the file is only possible when we use some time related pattern in the filename (which I should have deduced from "log_truncate_on_rotation" not working on the size driven rotation), I see the chances of getting what I need as very slim.

Any other suggestion would be greatly appreciated.

Thanks & Regards,
Amit

On Wed, Aug 18, 2010 at 3:41 PM, Thom Brown <thom@linux.com> wrote:
On 18 August 2010 10:54, Amit Soni <get.amitsoni@gmail.com> wrote:
> I tried this and the limit on the log file size works.
> The reason I didn't tried this before is that, I would probably have GB's of
> logs and the space consumed on the disk would be same in this case also with
> only difference in the number of file. Do we have some kind of pattern that
> would repeat itself so that we can have let's say only five log files which
> rotate themselves.
>

Yes, you can set "log_truncate_on_rotation" to "on" and adjust the
filename pattern.  However, I'd recommend not using size-based
rotation, but rather time-based.

So change:

log_filename to "postgresql-%H"
log_rotation_age to 60
log_rotation_size to 0

The log files will start being rotated after 24 hours as it will start
overwriting previous hours.

However, I'm not entirely sure how PostgreSQL decides to rotate "after
60 minutes".  If you start PostgreSQL at, say, 12:44, it would create:

postgresql-12.sql

At 13:44 I guess it would say "I need to rotate", so creates:

postgresql-13,.sql

So postgresql-12.sql contains log entries from 12:44 to 13:43.  If
this is the case, just bear it in mind and don't assume something like
"postgresql-15.sql" contains log entries from 15:00:00 to 15:59:59.

--
Thom Brown
Registered Linux user: #516935



--
Amit Soni
Software Engineer
Avaya India Pvt. Ltd.
Phone: +91-9579615149
Email-id: get.amitsoni@gmail.com, get.amitsoni@hotmail.com

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

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: Limiting the size of log files
Следующее
От: Thom Brown
Дата:
Сообщение: Re: Limiting the size of log files