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

Re: How to clear log files

From: Gabriel Parrondo <gabriel(dot)parrondo(at)ultragestion(dot)com(dot)ar>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to clear log files
Date: 2010-02-04 00:46:39
Message-ID: 1265244399.2838.4.camel@debian2 (view raw or flat)
Thread:
Lists: pgsql-admin
El mié, 03-02-2010 a las 15:12 -0600, Campbell, Lance escribió:
> PostgreSql:8.4.1
> 
> Is there a way for me to tell postgres to clear the log file.
> Example:  I have log files created with names corresponding to the
> days of the week.  This way they overwrite each other every week.
> When I deploy software enhancements I would like to clear the log file
> for the day without having to stop postgres.  This way anything I see
> I know was after the deployment of my enhancements.  I tried to just
> delete the file with postgres running.  I found that it did not
> recreate the log file so I was forced to restart postgres.
> 
Actually, when you delete an opened file it isn't really deleted.
Whatever program opened it can still read/write to it using the file
descriptor.

> Is there a command that might clear a log file or force it to rotate?
Truncating it like this should work:
echo > /path/to/logfile

There's probably a better way though.




In response to

pgsql-admin by date

Next:From: Achilleas MantziosDate: 2010-02-04 09:00:39
Subject: Re: Issues with LC_COLLATE, across 8.3/8.4 on various platforms
Previous:From: Campbell, LanceDate: 2010-02-03 22:09:33
Subject: pg_rotate_logfile function does not appear to work

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