Обсуждение: Logfile purge

Поиск
Список
Период
Сортировка

Logfile purge

От
Дата:

Hi,

 

I need help on PostGres 9.2 version. How to purge the logfile generated by the postgres server? How I can restrict the size of this file?

 

 

Regards

Shyamkant

Re: Logfile purge

От
Scott Marlowe
Дата:
On Wed, Dec 17, 2014 at 10:09 PM,  <shyamkant.dhamke@wipro.com> wrote:
> Hi,
>
> I need help on PostGres 9.2 version. How to purge the logfile generated by
> the postgres server? How I can restrict the size of this file?

Rotating logs is kinda the job of the OS (generally speaking).
Assuming you're on a modern unix like OS like Ubuntu, Debian, Redhat
or possibly BSD (Haven't used it in a few years) you will set your
postgresql.conf file to syslog mode, and then the rest of the
configuration is syslog and logrotate. google those two.

--
To understand recursion, one must first understand recursion.


Re: Logfile purge

От
Harshad Adalkonda
Дата:

On Thu, Dec 18, 2014 at 10:39 AM, <shyamkant.dhamke@wipro.com> wrote:

Hi,

 

I need help on PostGres 9.2 version. How to purge the logfile generated by the postgres server? How I can restrict the size of this file?

 

 

Regards

Shyamkant


Hi Shyamkant,

If you want purge the log file you set log_truncate_on_rotation=on in postgresql.conf
but this log_truncate_on_rotation works on time-drivan basic not on size, so you need to also specify log_rotation_age=1d .

You can restrict the size with log_rotation_size=10MB , but after 10MB it will create new file of 10MB again.

You can't use both the log_truncate_on_rotation & log_rotation_size at same time.

Thanks & Regards,

Harshad Adalkonda 
Database Administrator
harshad.adalkonda@shreeyansh.com

http://www.shreeyansh.com