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

Re: How to clear log files

From: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
To: "Campbell, Lance" <lance(at)illinois(dot)edu>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to clear log files
Date: 2010-02-03 21:33:49
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Wed, Feb 3, 2010 at 4:12 PM, Campbell, Lance <lance(at)illinois(dot)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.


In response to

pgsql-admin by date

Next:From: Plugge, Joe R.Date: 2010-02-03 21:36:10
Subject: Re: How to clear log files
Previous:From: Campbell, LanceDate: 2010-02-03 21:12:59
Subject: How to clear log files

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