How to clear log files

This is a multi-part message in MIME format.

------_=_NextPart_001_01CAA515.E3B602E6
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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.



Is there a command that might clear a log file or force it to rotate?



Thanks,



Lance Campbell

Software Architect/DBA/Project Manager

Web Services at Public Affairs

217-333-0382




------_=_NextPart_001_01CAA515.E3B602E6
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" =
xmlns:p=3D"urn:schemas-microsoft-com:office:powerpoint" =
xmlns:a=3D"urn:schemas-microsoft-com:office:access" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:s=3D"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" =
xmlns:rs=3D"urn:schemas-microsoft-com:rowset" xmlns:z=3D"#RowsetSchema" =
xmlns:b=3D"urn:schemas-microsoft-com:office:publisher" =
xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadsheet" =
xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" =
xmlns:odc=3D"urn:schemas-microsoft-com:office:odc" =
xmlns:oa=3D"urn:schemas-microsoft-com:office:activation" =
xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" =
xmlns:rtc=3D"http://microsoft.com/officenet/conferencing" =
xmlns:D=3D"DAV:" xmlns:Repl=3D"http://schemas.microsoft.com/repl/" =
xmlns:mt=3D"http://schemas.microsoft.com/sharepoint/soap/mee tings/" =
xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2003/x ml" =
xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" =
xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/oi s/" =
xmlns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/di rectory/" =
xmlns:ds=3D"http://www.w3.org/2000/09/xmldsig#" =
xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint/dsp" =
xmlns:udc=3D"http://schemas.microsoft.com/data/udc" =
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" =
xmlns:sub=3D"http://schemas.microsoft.com/sharepoint/soap/20 02/1/alerts/"=
xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#" =
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" =
xmlns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/soap" =
xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " =
xmlns:udcp2p=3D"http://schemas.microsoft.com/data/udc/partto part" =
xmlns:wf=3D"http://schemas.microsoft.com/sharepoint/soap/wor kflow/" =
xmlns:dsss=3D"http://schemas.microsoft.com/office/2006/digsi g-setup" =
xmlns:dssi=3D"http://schemas.microsoft.com/office/2006/digsi g" =
xmlns:mdssi=3D"http://schemas.openxmlformats.org/package/200 6/digital-sig=
nature" =
xmlns:mver=3D"http://schemas.openxmlformats.org/markup-compa tibility/2006=
" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns:mrels=3D"http://schemas.openxmlformats.org/package/200 6/relationshi=
ps" xmlns:spwp=3D"http://microsoft.com/sharepoint/webpartpages" =
xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/2006/types"=
=
xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/2006/messag=
es" =
xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ SlideLibrary/=
" =
xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor talServer/Pub=
lishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" =
xmlns:st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
..MsoChpDefault
{mso-style-type:export-only;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal>PostgreSql:8.4.1<o:p></o:p></p>

<p class=3DMsoNormal>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.<o:p></o:p></p>

<p class=3DMsoNormal><o:p> </o:p></p>

<p class=3DMsoNormal>Is there a command that might clear a log file or =
force it
to rotate?<o:p></o:p></p>

<p class=3DMsoNormal> <o:p></o:p></p>

<p class=3DMsoNormal>Thanks,<o:p></o:p></p>

<p class=3DMsoNormal><o:p> </o:p></p>

<p class=3DMsoNormal>Lance Campbell<o:p></o:p></p>

<p class=3DMsoNormal>Software Architect/DBA/Project =
Manager<o:p></o:p></p>

<p class=3DMsoNormal>Web Services at Public Affairs<o:p></o:p></p>

<p class=3DMsoNormal>217-333-0382<o:p></o:p></p>

<p class=3DMsoNormal><o:p> </o:p></p>

</div>

</body>

</html>

------_=_NextPart_001_01CAA515.E3B602E6--
Lance [ Mi, 03 Februar 2010 22:12 ] [ ID #2031140 ]

Re: How to clear log files

--0016e6d464cc603663047eb8f966
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Feb 3, 2010 at 4:12 PM, Campbell, Lance <lance [at] illinois.edu> wrote:

> 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.
>
>
>
> Is there a command that might clear a log file or force it to rotate?
>

You should be able to set 'log_truncate_on_rotation=on' in postgresql.conf
and then run:

select pg_rotate_logfile();

That should rotate it, and if you have your log_filename setup with day of
week only, it should truncate and restart in the same logfile. Haven't
tested it, so I may be wrong, but it's worth a shot.

--Scott

--0016e6d464cc603663047eb8f966
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote">On Wed, Feb 3, 2010 at 4:12 PM, Campbell, Lance =
<span dir=3D"ltr"><<a href=3D"mailto:lance [at] illinois.edu">lance [at] illinois.=
edu</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">









<div lang=3D"EN-US" link=3D"blue" vlink=3D"purple">

<div>

<p class=3D"MsoNormal">PostgreSql:8.4.1</p>

<p class=3D"MsoNormal">Is there a way for me to tell postgres to clear the =
log
file.=A0 Example:=A0 I have log files created with names corresponding to
the days of the week.=A0 This way they overwrite each other every week.=A0
When I deploy software enhancements I would like to clear the log file for =
the
day without having to stop postgres.=A0 This way anything I see I know was
after the deployment of my enhancements.=A0 I tried to just delete the file
with postgres running.=A0 I found that it did not recreate the log file so =
I
was forced to restart postgres.</p>

<p class=3D"MsoNormal">=A0</p>

<p class=3D"MsoNormal">Is there a command that might clear a log file or fo=
rce it
to rotate?</p></div></div></blockquote><div><br></div><div>You should be ab=
le to set 'log_truncate_on_rotation=3Don' in postgresql.conf and th=
en run:</div><div><br></div><div>select pg_rotate_logfile();</div><div><br>
</div><div>That should rotate it, and if you have your log_filename setup w=
ith day of week only, it should truncate and restart in the same logfile. =
=A0Haven't tested it, so I may be wrong, but it's worth a shot.</di=
v>
<div><br></div><div>--Scott</div></div>

--0016e6d464cc603663047eb8f966--
Scott Mead [ Mi, 03 Februar 2010 22:33 ] [ ID #2031141 ]

Re: How to clear log files

--_000_BD69807DAE0CE44CA00A8338D0FDD0830185A615A8oma00cexmbx 03_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

What platform? If in Unix/Linux, just:

cat /dev/null > postgres_logfile

or > postgres_logfile

Most running programs don't like it when you delete a file with an open fil=
e handle but you it doesn't mind if you clear it on the fly. Not sure how =
to do this in a Windows environment.

From: pgsql-admin-owner [at] postgresql.org [mailto:pgsql-admin-owner [at] postgresql=
..org] On Behalf Of Campbell, Lance
Sent: Wednesday, February 03, 2010 3:13 PM
To: pgsql-admin [at] postgresql.org
Subject: [ADMIN] How to clear log files

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. T=
his way they overwrite each other every week. When I deploy software enhan=
cements I would like to clear the log file for the day without having to st=
op 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 f=
ound that it did not recreate the log file so I was forced to restart postg=
res.

Is there a command that might clear a log file or force it to rotate?

Thanks,

Lance Campbell
Software Architect/DBA/Project Manager
Web Services at Public Affairs
217-333-0382


--_000_BD69807DAE0CE44CA00A8338D0FDD0830185A615A8oma00cexmbx 03_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:p=3D"urn:schemas-m=
icrosoft-com:office:powerpoint" xmlns:a=3D"urn:schemas-microsoft-com:office=
:access" xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s=3D"=
uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs=3D"urn:schemas-microsof=
t-com:rowset" xmlns:z=3D"#RowsetSchema" xmlns:b=3D"urn:schemas-microsoft-co=
m:office:publisher" xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadshee=
t" xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" xmlns=
:odc=3D"urn:schemas-microsoft-com:office:odc" xmlns:oa=3D"urn:schemas-micro=
soft-com:office:activation" xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc=3D"http://m=
icrosoft.com/officenet/conferencing" xmlns:D=3D"DAV:" xmlns:Repl=3D"http://=
schemas.microsoft.com/repl/" xmlns:mt=3D"http://schemas.microsoft.com/share=
point/soap/meetings/" xmlns:x2=3D"http://schemas.microsoft.com/office/excel=
/2003/xml" xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" xmlns:ois=
=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir=3D"http://=
schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds=3D"http://www.w3=
..org/2000/09/xmldsig#" xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint=
/dsp" xmlns:udc=3D"http://schemas.microsoft.com/data/udc" xmlns:xsd=3D"http=
://www.w3.org/2001/XMLSchema" xmlns:sub=3D"http://schemas.microsoft.com/sha=
repoint/soap/2002/1/alerts/" xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#"=
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" xmlns:sps=3D"http://=
schemas.microsoft.com/sharepoint/soap/" xmlns:xsi=3D"http://www.w3.org/2001=
/XMLSchema-instance" xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/so=
ap" xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " xmlns:udc=
p2p=3D"http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf=3D"http:/=
/schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss=3D"http://sche=
mas.microsoft.com/office/2006/digsig-setup" xmlns:dssi=3D"http://schemas.mi=
crosoft.com/office/2006/digsig" xmlns:mdssi=3D"http://schemas.openxmlformat=
s.org/package/2006/digital-signature" xmlns:mver=3D"http://schemas.openxmlf=
ormats.org/markup-compatibility/2006" xmlns:m=3D"http://schemas.microsoft.c=
om/office/2004/12/omml" xmlns:mrels=3D"http://schemas.openxmlformats.org/pa=
ckage/2006/relationships" xmlns:spwp=3D"http://microsoft.com/sharepoint/web=
partpages" xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/20=
06/types" xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/200=
6/messages" xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ Sli=
deLibrary/" xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor tal=
Server/PublishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" xmlns:=
st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
[at] font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
[at] font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Tahoma","sans-serif";
color:black;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
..MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
/* List Definitions */
[at] list l0
{mso-list-id:786049289;
mso-list-type:hybrid;
mso-list-template-ids:856474580 -1067172824 67698691 67698693 67698689 676=
98691 67698693 67698689 67698691 67698693;}
[at] list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:\F0D8;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:Tahoma;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span style=3D'font-size:10.0pt;font-family:"Tahoma","=
sans-serif";
color:black'>What platform?  If in Unix/Linux, just:<o:p></o:p></span>=
</p>

<p class=3DMsoNormal><span style=3D'font-size:10.0pt;font-family:"Tahoma","=
sans-serif";
color:black'><o:p> </o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:10.0pt;font-family:"Tahoma","=
sans-serif";
color:black'> <b>cat /dev/null > postgres_logfile<o:p></o:p></b></s=
pan></p>

<p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"Tahoma=
","sans-serif";
color:black'><o:p> </o:p></span></b></p>

<p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"Tahoma=
","sans-serif";
color:black'>or          =
         > postgres_logfile<o:p>=
</o:p></span></b></p>

<p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"Tahoma=
","sans-serif";
color:black'><o:p> </o:p></span></b></p>

<p class=3DMsoNormal><span style=3D'font-size:10.0pt;font-family:"Tahoma","=
sans-serif";
color:black'>Most running programs don’t like it when you delete a fi=
le with an
open file handle but you it doesn’t mind if you clear it on the fly.&=
nbsp; Not sure
how to do this in a Windows environment.<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:10.0pt;font-family:"Tahoma","=
sans-serif";
color:black'><o:p> </o:p></span></p>

<div>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in'>

<p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"Tahoma=
","sans-serif"'>From:</span></b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >
pgsql-admin-owner [at] postgresql.org [mailto:pgsql-admin-owner [at] postgresql.org] =
<b>On
Behalf Of </b>Campbell, Lance<br>
<b>Sent:</b> Wednesday, February 03, 2010 3:13 PM<br>
<b>To:</b> pgsql-admin [at] postgresql.org<br>
<b>Subject:</b> [ADMIN] How to clear log files<o:p></o:p></span></p>

</div>

</div>

<p class=3DMsoNormal><o:p> </o:p></p>

<p class=3DMsoNormal>PostgreSql:8.4.1<o:p></o:p></p>

<p class=3DMsoNormal>Is there a way for me to tell postgres to clear the lo=
g
file.  Example:  I have log files created with names correspondin=
g 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 l=
og
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 recrea=
te
the log file so I was forced to restart postgres.<o:p></o:p></p>

<p class=3DMsoNormal><o:p> </o:p></p>

<p class=3DMsoNormal>Is there a command that might clear a log file or forc=
e it
to rotate?<o:p></o:p></p>

<p class=3DMsoNormal> <o:p></o:p></p>

<p class=3DMsoNormal>Thanks,<o:p></o:p></p>

<p class=3DMsoNormal><o:p> </o:p></p>

<p class=3DMsoNormal>Lance Campbell<o:p></o:p></p>

<p class=3DMsoNormal>Software Architect/DBA/Project Manager<o:p></o:p></p>

<p class=3DMsoNormal>Web Services at Public Affairs<o:p></o:p></p>

<p class=3DMsoNormal>217-333-0382<o:p></o:p></p>

<p class=3DMsoNormal><o:p> </o:p></p>

</div>

</body>

</html>

--_000_BD69807DAE0CE44CA00A8338D0FDD0830185A615A8oma00cexmbx 03_--
JRPlugge [ Mi, 03 Februar 2010 22:36 ] [ ID #2031142 ]

Re: How to clear log files

El mi=C3=A9, 03-02-2010 a las 15:12 -0600, Campbell, Lance escribi=C3=B3:
> 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.




--
Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Gabriel Parrondo [ Do, 04 Februar 2010 01:46 ] [ ID #2031270 ]
Datenbanken » gmane.comp.db.postgresql.admin » How to clear log files

Vorheriges Thema: Issues with LC_COLLATE, across 8.3/8.4 on various platforms
Nächstes Thema: pg_rotate_logfile function does not appear to work