Обсуждение: How to rotate postgres logfiles

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

How to rotate postgres logfiles

От
Ferdinand Smit
Дата:
Hi,

Does anyone know how to flush the logfiles op postgres. I need it for
logrotate.
'/usr/lib/postgresql/bin/pg_ctl reload' does not work, it does not create a
new logfile.

Regards,
Ferdinand

Re: How to rotate postgres logfiles

От
"Rajesh Kumar Mallah."
Дата:
Hi ,

This question has been asked before in the list
by me.

and below is an workable solution provided by Gaetano


regds
mallah.

---------------------------------------------
Well,
the most correct way to do a logrotate is ( Redhat ):

1) Put on your postgresql.conf the following lines:

syslog = 2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

2)  Put on the directory /etc/logrotate.d a file called
'postgres' with the following lines:

/var/log/postgresql.log {
    compress
    rotate 2
    size=10000k
    errors mendola@bigfoot.com
    create 0664 postgres postgres
    daily
    postrotate
             /usr/bin/killall -HUP syslogd
    endscript
}

change the email address of course :-)

3) Put the following line on your /etc/syslog.conf

# Save postgresql logs
LOCAL0.*
/var/log/postgresql.log


Ciao
Gaetano

--
#exclude <windows>
#include <CSRSS>
printf("\t\t\b\b\b\b\b\b");.
printf("\t\t\b\b\b\b\b\b");




On Monday 27 May 2002 05:20 pm, Ferdinand Smit wrote:
> Hi,
>
> Does anyone know how to flush the logfiles op postgres. I need it for
> logrotate.
> '/usr/lib/postgresql/bin/pg_ctl reload' does not work, it does not create a
> new logfile.
>
> Regards,
> Ferdinand
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.