Thread: is it possible to delete the psql log while psql is running?
hi, i'd like to delete the postgresql log file (resides in /var/log/pgsql/postgres), because it has become too big. can i simply delete the file while postgresql is running? or do i have to stop postgresql first, and only delete the logfile after that? thanks, gabor -- That's life for you, said McDunn. Someone always waiting for someone who never comes home. Always someone loving something more than that thing loves them. And after awhile you want to destroy whatever that thing is, so it can't hurt you no more. -- R. Bradbury, "The Fog Horn"
gabor schrieb: > hi, > > i'd like to delete the postgresql log file > (resides in /var/log/pgsql/postgres), > because it has become too big. > > can i simply delete the file while postgresql is running? > > or do i have to stop postgresql first, and only delete the logfile after > that? echo -n >postgresql.log delete will have no effect unless the last process takes hands off the file. HTH Tino
I'd do echo > pgql.log Oleg On Thu, 8 Dec 2005, gabor wrote: > > hi, > > i'd like to delete the postgresql log file > (resides in /var/log/pgsql/postgres), > because it has become too big. > > can i simply delete the file while postgresql is running? > > or do i have to stop postgresql first, and only delete the logfile after > that? > > thanks, > gabor > > > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83
cat /dev/null > name_of_log_to_truncate -----Original Message----- From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of gabor Sent: Thursday, December 08, 2005 6:21 AM To: pgsql-general@postgresql.org Subject: [GENERAL] is it possible to delete the psql log while psql is running? hi, i'd like to delete the postgresql log file (resides in /var/log/pgsql/postgres), because it has become too big. can i simply delete the file while postgresql is running? or do i have to stop postgresql first, and only delete the logfile after that? thanks, gabor -- That's life for you, said McDunn. Someone always waiting for someone who never comes home. Always someone loving something more than that thing loves them. And after awhile you want to destroy whatever that thing is, so it can't hurt you no more. -- R. Bradbury, "The Fog Horn" ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
On Thursday December 8 2005 9:19 am, Oleg Bartunov wrote: > I'd do > echo > pgql.log That won't free any space from an open file. You have to stop postgresql first in order to close the file, or use log file rotation and wait until it rotates out to a closed state. Ed > > Oleg > > On Thu, 8 Dec 2005, gabor wrote: > > hi, > > > > i'd like to delete the postgresql log file > > (resides in /var/log/pgsql/postgres), > > because it has become too big. > > > > can i simply delete the file while postgresql is running? > > > > or do i have to stop postgresql first, and only delete the > > logfile after that? > > > > thanks, > > gabor > > Regards, > Oleg > _____________________________________________________________ > Oleg Bartunov, Research Scientist, Head of AstroNet > (www.astronet.ru), Sternberg Astronomical Institute, Moscow > University, Russia Internet: oleg@sai.msu.su, > http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, > +007(495)939-23-83 > > ---------------------------(end of > broadcast)--------------------------- TIP 5: don't forget to > increase your free space map settings
hi, use "cp /dev/null pqsql.log" to truncate the logfile "in place" and free some space. re, thies Am 08.12.2005 um 23:26 schrieb Ed L.: > On Thursday December 8 2005 9:19 am, Oleg Bartunov wrote: >> I'd do >> echo > pgql.log > > That won't free any space from an open file. You have to stop > postgresql first in order to close the file, or use log file > rotation and wait until it rotates out to a closed state.