pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Mead <scott.lists@enterprisedb.com>
To: Campbell, Lance <lance@illinois.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: How to clear log files
Date: Wed, 3 Feb 2010 16:33:49 -0500
Message-ID: <d3ab2ec81002031333v3ee0a616j71fc9b1173f4b3a0@mail.gmail.com> (raw)
In-Reply-To: <B10E6810AC2A2F4EA7550D072CDE876004B2E09C@SAB-FENWICK.sab.uiuc.edu>
References: <B10E6810AC2A2F4EA7550D072CDE876004B2E09C@SAB-FENWICK.sab.uiuc.edu>

On Wed, Feb 3, 2010 at 4:12 PM, Campbell, Lance <lance@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

view thread (4+ messages)  latest in thread

Message-ID: <d3ab2ec81002031333v3ee0a616j71fc9b1173f4b3a0@mail.gmail.com>
Permalink:  ../d3ab2ec81002031333v3ee0a616j71fc9b1173f4b3a0@mail.gmail.com/
Also on:    postgresql.org/message-id/d3ab2ec81002031333v3ee0a616j71fc9b1173f4b3a0@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.lists@enterprisedb.com, lance@illinois.edu
  Subject: Re: How to clear log files
  In-Reply-To: <d3ab2ec81002031333v3ee0a616j71fc9b1173f4b3a0@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox