RE: [7.0.2] rotating log files ... - Mailing list pgsql-admin

From Neil Toronto
Subject RE: [7.0.2] rotating log files ...
Date
Msg-id 14A4DCD7F3CED3118749009027DCBFE4C81EFC@smtp.stsrvcs.com
Whole thread Raw
In response to [7.0.2] rotating log files ...  (The Hermit Hacker <scrappy@hub.org>)
Responses RE: [7.0.2] rotating log files ...  (The Hermit Hacker <scrappy@hub.org>)
Re: [7.0.2] rotating log files ...  (Ragnar Kjørstad <postgres@ragnark.vestdata.no>)
List pgsql-admin
The process still has an open file handle, and will continue to do so even
after you move it.  So, if your file is /var/log/messages, and you do a mv
/var/log/messages /var/log/messages.old or something (I know that's stupid,
but this is an example), the process will continue to write to
/var/log/messages.old.

The best way is what Chris said: copy the file, and cat /dev/null > logfile.
That'll truncate it well.

-----Original Message-----
From: Ragnar Kjørstad [mailto:postgres@ragnark.vestdata.no]

What's wrong with moving the file when it's in use?

Copying the file will take much longer, and you might loose log-entries
that are written after cp but before truncate.


--
Ragnar Kjorstad

pgsql-admin by date:

Previous
From: Alfred Perlstein
Date:
Subject: Re: [7.0.2] rotating log files ...
Next
From: The Hermit Hacker
Date:
Subject: RE: [7.0.2] rotating log files ...