pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Lowry <dlowry@bju.edu>
To: Joshua D.Drake <jd@commandprompt.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org
Subject: Re: way to turn off epochs in log_filename
Date: Sat, 27 Oct 2007 11:14:37 -0400
Message-ID: <0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu> (raw)
In-Reply-To: <20071026154202.501e9b75@scratch>
References: <E11307EB-94DF-4CDD-A89D-0C88A84F2B99@bju.edu>
	<26960.1193434395@sss.pgh.pa.us>
	<20071026144005.3aa6cc29@scratch>
	<27413.1193435100@sss.pgh.pa.us>
	<20071026154202.501e9b75@scratch>

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.



view thread (9+ messages)  latest in thread

Message-ID: <0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu>
Permalink:  ../0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu/
Also on:    postgresql.org/message-id/0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu

 · 

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-admin@postgresql.org
  Cc: dlowry@bju.edu, jd@commandprompt.com, tgl@sss.pgh.pa.us
  Subject: Re: way to turn off epochs in log_filename
  In-Reply-To: <0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu>
  References: <E11307EB-94DF-4CDD-A89D-0C88A84F2B99@bju.edu> <26960.1193434395@sss.pgh.pa.us> <20071026144005.3aa6cc29@scratch> <27413.1193435100@sss.pgh.pa.us> <20071026154202.501e9b75@scratch> <0072EC59-9FE8-461D-AD30-5116F19A1BF7@bju.edu>

* 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