Skip site navigation (1) Skip section navigation (2)

Re: Limiting the size of log files

From: Amit Soni <get(dot)amitsoni(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Limiting the size of log files
Date: 2010-08-18 10:34:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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
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,

On Wed, Aug 18, 2010 at 3:41 PM, Thom Brown <thom(at)linux(dot)com> wrote:

> On 18 August 2010 10:54, Amit Soni <get(dot)amitsoni(at)gmail(dot)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(dot)amitsoni(at)gmail(dot)com, get(dot)amitsoni(at)hotmail(dot)com

In response to


pgsql-novice by date

Next:From: Thom BrownDate: 2010-08-18 10:43:36
Subject: Re: Limiting the size of log files
Previous:From: Thom BrownDate: 2010-08-18 10:11:34
Subject: Re: Limiting the size of log files

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group