Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 705E51337C1C for ; Thu, 17 Mar 2011 17:00:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 75809-08 for ; Thu, 17 Mar 2011 20:00:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og102.obsmtp.com (exprod7og102.obsmtp.com [64.18.2.157]) by mail.postgresql.org (Postfix) with ESMTP id CC54D1337C0F for ; Thu, 17 Mar 2011 17:00:25 -0300 (ADT) Received: from source ([209.85.216.41]) (using TLSv1) by exprod7ob102.postini.com ([64.18.6.12]) with SMTP ID DSNKTYJoWTQ51Y7AUmW3oGt3UQwOdnoqXYlw@postini.com; Thu, 17 Mar 2011 13:00:26 PDT Received: by qwa26 with SMTP id 26so2478242qwa.28 for ; Thu, 17 Mar 2011 13:00:23 -0700 (PDT) Received: by 10.224.18.202 with SMTP id x10mr187535qaa.285.1300392023738; Thu, 17 Mar 2011 13:00:23 -0700 (PDT) Received: from [192.168.2.36] (va-76-4-65-131.sta.embarqhsd.net [76.4.65.131]) by mx.google.com with ESMTPS id l12sm1683572qcu.31.2011.03.17.13.00.19 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Mar 2011 13:00:21 -0700 (PDT) Subject: Re: BUG #5935: Log lotation not working for default log format Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Korry Douglas In-Reply-To: <201103171936.p2HJaRN4011070@wwwmaster.postgresql.org> Date: Thu, 17 Mar 2011 16:00:17 -0400 Cc: pgsql-bugs@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <20092C1D-FD22-4AE7-8245-9EE91F04F1B7@enterprisedb.com> References: <201103171936.p2HJaRN4011070@wwwmaster.postgresql.org> To: "Brad Nicholson" X-Mailer: Apple Mail (2.1082) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201103/242 X-Sequence-Number: 29752 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: >=20 > 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:=20 >=20 > 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) >=20 > (using the standard PG package) >=20 > 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. >=20 >=20 > 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().=20 > Both fail to rotate the log file. >=20 >=20 > Manual Rotate: >=20 > [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) >=20 > [postgres@pg1 pgdata]$ psql -p 6432 -c "SELECT pg_rotate_logfile()" > postgres > pg_rotate_logfile > ------------------- > t > (1 row) >=20 > [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 >=20 >=20 >=20 > Size based automatic rotation: >=20 > [postgres@pg1 pgdata]$ psql -p 6432 -c "show log_rotation_size;" = postgres > log_rotation_size > ------------------- > 1MB > (1 row) >=20 > >=20 > [postgres@pg1 pgdata]$ ls -thl logs/ > total 3.2M > -rw------- 1 postgres postgres 3.2M Mar 17 13:24 postgresql-Thu.log >=20 >=20 >=20 > If I switch the log_filename to something more specific like > postgresql-%Y-%m-%d_%H_%M_%S.log - the logfile rotates. >=20 > --=20 > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs