pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Korry Douglas <korry.douglas@enterprisedb.com>
To: Brad Nicholson <bnicholson@hp.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5935: Log lotation not working for default log format
Date: Thu, 17 Mar 2011 16:00:17 -0400
Message-ID: <20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.com> (raw)
In-Reply-To: <201103171936.p2HJaRN4011070@wwwmaster.postgresql.org>
References: <201103171936.p2HJaRN4011070@wwwmaster.postgresql.org>

What would you expect the new log file to be named?  Your log_filename is set to postgresql-%a.log.  The %a part expands to the current day of the week.  If it's Thursday and you already have a file for Thursday, what would the new file name be?

		-- Korry

> The following bug has been logged online:
> 
> Bug reference:      5935
> Logged by:          Brad Nicholson
> Email address:      bnicholson@hp.com
> PostgreSQL version: 9.0.3
> Operating system:   CentOS Release 5.5
> Description:        Log lotation not working for default log format
> Details: 
> 
> PostgreSQL 9.0.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
> 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit
> CentOS release 5.5 (Final)
> 
> (using the standard PG package)
> 
> The logfile will not rotate if the log_filename is set to postgresql-%a.log,
> which is the default setting after an initdb on my platform.
> 
> 
> I have tested this by setting log_rotation_size and exceeding that threshold
> and manually trying to rotate the logs with SELECT pg_rotate_logfile(). 
> Both fail to rotate the log file.
> 
> 
> Manual Rotate:
> 
> [postgres@pg1 pgdata]$ ls -al logs/
> total 24
> drwxr-xr-x 2 postgres postgres 4096 Mar 17 13:11 .
> drwxr-xr-x 4 postgres postgres 4096 Mar 17 13:08 ..
> -rw------- 1 postgres postgres  150 Mar 17 13:11 postgresql-Thu.log
> [postgres@pg1 pgdata]$ psql -p 6432  -c "show log_filename;" postgres
>   log_filename
> -------------------
> postgresql-%a.log
> (1 row)
> 
> [postgres@pg1 pgdata]$ psql -p 6432 -c "SELECT pg_rotate_logfile()"
> postgres
> pg_rotate_logfile
> -------------------
> t
> (1 row)
> 
> [postgres@pg1 pgdata]$ ls -al logs/
> total 24
> drwxr-xr-x 2 postgres postgres 4096 Mar 17 13:11 .
> drwxr-xr-x 4 postgres postgres 4096 Mar 17 13:08 ..
> -rw------- 1 postgres postgres  150 Mar 17 13:11 postgresql-Thu.log
> 
> 
> 
> Size based automatic rotation:
> 
> [postgres@pg1 pgdata]$ psql -p 6432  -c "show log_rotation_size;" postgres
> log_rotation_size
> -------------------
> 1MB
> (1 row)
> 
> <generate some pgbench traffic with full statement logging>
> 
> [postgres@pg1 pgdata]$ ls -thl logs/
> total 3.2M
> -rw------- 1 postgres postgres 3.2M Mar 17 13:24 postgresql-Thu.log
> 
> 
> 
> If I switch the log_filename to something more specific like
> postgresql-%Y-%m-%d_%H_%M_%S.log - the logfile rotates.
> 
> -- 
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs




view thread (4+ messages)  latest in thread

Message-ID: <20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.com>
Permalink:  ../20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.com/
Also on:    postgresql.org/message-id/20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: korry.douglas@enterprisedb.com, bnicholson@hp.com
  Subject: Re: BUG #5935: Log lotation not working for default log format
  In-Reply-To: <20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.com>
  References: <201103171936.p2HJaRN4011070@wwwmaster.postgresql.org> <20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.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