is it possible to delete the psql log while psql is running?

Started by Gábor Farkasover 20 years ago6 messagesgeneral
Jump to latest
#1Gábor Farkas
gabor@nekomancer.net

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"

#2Cook, Steve
STEVE.COOK@NEXTIRAONE.COM
In reply to: Gábor Farkas (#1)
Re: is it possible to delete the psql log while psql is running?

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

#3Tino Wildenhain
tino@wildenhain.de
In reply to: Gábor Farkas (#1)
Re: is it possible to delete the psql log while psql is

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

#4Oleg Bartunov
oleg@sai.msu.su
In reply to: Gábor Farkas (#1)
Re: is it possible to delete the psql log while psql is

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

#5Ed L.
pgsql@bluepolka.net
In reply to: Oleg Bartunov (#4)
Re: is it possible to delete the psql log while psql is

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

Show quoted text

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

#6Thies C. Arntzen
thies@thieso.net
In reply to: Ed L. (#5)
Re: is it possible to delete the psql log while psql is

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.:

Show quoted text

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.