Re: more contrib: log rotator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Andrew Sullivan <andrew(at)libertyrms(dot)info>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: more contrib: log rotator
Date: 2003-04-05 00:22:58
Message-ID: 10790.1049502178@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane writes:
>> AFAICS, the only practical way to do this is to have a single process
>> collecting the stdout/stderr from the postmaster and all its children.

> I think not. It's a little tricky handling it directly in the child
> processes, but it's been done before.

A "little" tricky? Thanks, but no thanks ... for one thing, there'd be
no easy way to know when all the children had switched over to writing
the new file. Also, at least for not-too-long messages, writing on a
single pipe gives atomicity guarantees that AFAIK do not exist when
writing a file through multiple independently opened descriptors. In
the latter case I think we'd have lots of trouble with interleaving of
messages from different backends.

>> If someone can offer a better alternative than Andrew's, great, let's
>> see it.

> How about the attached one, which I floated a while ago but which didn't
> generate much interest.

Seems like a good bare-bones file writer; but how about all those
frammishes that people ask for like generating date-based filenames,
switching every so many bytes, etc? Also, it'd be nice not to be
dependent on a cron job to tickle the switchover.

I do think there's an efficiency argument for having the log writer
coded in C, so starting with what you have here and building up might
be a better idea than starting with Andrew's perl script. But the
important thing in my mind is to get something in there.

We should also take a look at Apache's rotator to see if there's any need
to reinvent the wheel at all. I have not seen it, am not even sure what
it's written in...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Barry Lind 2003-04-05 01:49:22 Re: Changing behavior of BEGIN...sleep...do something...COMMIT
Previous Message Peter Eisentraut 2003-04-05 00:03:03 Re: more contrib: log rotator