Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 098DA1337BEA for ; Thu, 17 Mar 2011 16:36:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 98378-03 for ; Thu, 17 Mar 2011 19:36:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 5355F1337BD8 for ; Thu, 17 Mar 2011 16:36:27 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p2HJaRaP011071 for ; Thu, 17 Mar 2011 19:36:27 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p2HJaRN4011070; Thu, 17 Mar 2011 19:36:27 GMT (envelope-from www) Date: Thu, 17 Mar 2011 19:36:27 GMT Message-Id: <201103171936.p2HJaRN4011070@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5935: Log lotation not working for default log format From: "Brad Nicholson" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201103/241 X-Sequence-Number: 29751 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) [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.