Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 5799C9FA303 for ; Sat, 27 Oct 2007 12:15:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 70604-05-3 for ; Sat, 27 Oct 2007 12:14:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ns.bju.edu (ns.bju.edu [158.158.239.1]) by postgresql.org (Postfix) with ESMTP id 68F429FB61A for ; Sat, 27 Oct 2007 12:14:47 -0300 (ADT) Received: from IBarr.bju.edu ([158.158.240.249]) by ns.bju.edu (Switch-2.2.8/Switch-2.2.8) with ESMTP id l9RFEjJ30512; Sat, 27 Oct 2007 11:14:45 -0400 Received: from ns1.bju.edu (ns1.bju.edu [158.158.100.232]) by IBarr.bju.edu (Spam Firewall) with ESMTP id 7D89A1C46F2; Sat, 27 Oct 2007 11:14:39 -0400 (EDT) Received: from ns1.bju.edu (ns1.bju.edu [158.158.100.232]) by IBarr.bju.edu with ESMTP id JdnYlPyH19X3w3VU; Sat, 27 Oct 2007 11:14:39 -0400 (EDT) Received: from [158.158.26.36] (dlowrymac.bju.edu [158.158.26.36]) by ns1.bju.edu (Postfix) with ESMTP id 5C03111547B; Sat, 27 Oct 2007 11:14:39 -0400 (EDT) In-Reply-To: <20071026154202.501e9b75@scratch> References: <26960.1193434395@sss.pgh.pa.us> <20071026144005.3aa6cc29@scratch> <27413.1193435100@sss.pgh.pa.us> <20071026154202.501e9b75@scratch> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu> Cc: Tom Lane , pgsql-admin@postgresql.org Content-Transfer-Encoding: 7bit From: David Lowry Subject: Re: way to turn off epochs in log_filename Date: Sat, 27 Oct 2007 11:14:37 -0400 To: "Joshua D.Drake" X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/277 X-Sequence-Number: 27191 On Oct 26, 2007, at 6:42 PM, Joshua D. Drake wrote: >>>> If logrotate would work, we'd never have bothered writing our own >>>> substitute. But there's no way for logrotate to repoint >>>> postmaster's stderr into other files. >> >>> Uh... can't we just use copytruncate with logroate? >> >> How's that going to reset the offsets in the stderr file descriptors >> of the various PG processes? There might be some platforms and >> configurations where it will work, but I wouldn't tout it as a >> portable approach. I'd also suppose that there are race conditions >> involved: you'll either lose or duplicate messages that are emitted >> while copytruncate works. > > Yeah, we have seen that, where the log will be missing a few > statements. Good point. If I'm not mistaken, it would be more of a move combined with creating a new file. My impression was that the sequence worked something like this: 1. Logrotate moves the old log file to a new name, equivalent to something like this: mv postgresql.log postgresql.log.1 In the mean time, PG keeps writing to the same file. 2. Logrotate sends a HUP (as configured in the logrotate conf) to the postmaster process, which causes PG to close the old log file (postgresql.log.1) and open a new one (postgresql.log). If I understand correctly, you're saying that this process either won't work or isn't portable. Is that correct? BTW, my rational is that we use logrotate for most of our other logs, so I would like to put PG in the same system. If what I suggested above won't work, I'll just set up PG to write to something like postgresql.log_20070101 and write a script to gzip and clean up old logs.