Log File Maintainance

Started by Inpreet Singhabout 21 years ago4 messagesgeneral
Jump to latest
#1Inpreet Singh
Singh.Inpreet@netsity.com

Hello,

I am working on live server where we have installed postgres database as
our back end. But now the problem is due to continues work on postgres,
size of log files has become problem for us. And the partition where our
postgres exists is full. Postmaster is not working now. I tried to
rotate log file by adding lines in postgresql.conf
****************************************************
syslog = 2 # range 0-2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
********************************
But it doesn't working. Is there anything else I had to due in this
respect. I think I am missing some point.

Also I had written rotate script and save it at location
:/etc/logrotate.d
******************************************************
/usr/local/pgsql/data/serverlog
{
weekly
notifempty
rotate 2
create
/bin/kill -HUP `cat /usr/local/pgsql/data/postmaster.pid 2>
/dev/null` 2> /dev/null || true
endscript
}
***************************************************
But when I am executing following command it is flagging error
**************************************************
/etc/logrotate/postgres
[root@server logrotate.d]# logrotate -f -v postgres
reading config file postgres
reading config info for /usr/local/pgsql/data/logfile

error: postgres:6 unexpected log filename
*************************************************

Please guide me thru...............
Inpreet Singh

#2Richard Huxton
dev@archonet.com
In reply to: Inpreet Singh (#1)
Re: Log File Maintainance

Inpreet Singh wrote:

Hello,

I am working on live server where we have installed postgres database as
our back end. But now the problem is due to continues work on postgres,
size of log files has become problem for us. And the partition where our
postgres exists is full. Postmaster is not working now. I tried to
rotate log file by adding lines in postgresql.conf
****************************************************
syslog = 2 # range 0-2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

You also need to update your syslog.conf and restart syslogd

Add a line like:
local0.* /var/log/pgsql

Read the man page(s) for details.
--
Richard Huxton
Archonet Ltd

#3Oleg Bartunov
oleg@sai.msu.su
In reply to: Richard Huxton (#2)
Re: Log File Maintainance

On Tue, 12 Apr 2005, Richard Huxton wrote:

Inpreet Singh wrote:

Hello,
I am working on live server where we have installed postgres database as
our back end. But now the problem is due to continues work on postgres,
size of log files has become problem for us. And the partition where our
postgres exists is full. Postmaster is not working now. I tried to
rotate log file by adding lines in postgresql.conf
****************************************************
syslog = 2 # range 0-2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

You also need to update your syslog.conf and restart syslogd

Add a line like:
local0.* /var/log/pgsql

probably, better -/var/log/pgsql

Read the man page(s) for details.

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

#4Richard Huxton
dev@archonet.com
In reply to: Inpreet Singh (#1)
Re: Log File Maintainance

Neil Dugan wrote:

On Tue, 2005-04-12 at 08:51 +0100, Richard Huxton wrote:

Inpreet Singh wrote:

syslog = 2 # range 0-2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

You also need to update your syslog.conf and restart syslogd

Add a line like:
local0.* /var/log/pgsql

Saw this post and tried to setup the log info to be sent to a different
file '/var/log/pgsql'. There was no trouble with this.

I then thought I would use a more logical name than 'LOCAL0' for the
facility name. However no matter what name I tried
'/etc/init.d/postgresql' wouldn't restart the 'postmaster' program.

The local0/1/etc facilities are for "custom" applications logging to
syslog. You can see a list of valid facilities with "man syslog.conf"

HTH
--
Richard Huxton
Archonet Ltd