Re: logfile subprocess and Fancy File Functions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: logfile subprocess and Fancy File Functions
Date: 2004-07-20 03:39:00
Message-ID: 200407200339.i6K3d0Y12516@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andreas Pflug wrote:
> Updated patch which leaves postmaster runnable after the syslogger
> terminated due to pipe problems.

Very nice. You did a nice trick of reading the log filenames into a
timestamp field:

count = sscanf(de->d_name, "%04d-%02d-%02d_%02d%02d%02d_%05d.log", &yea$

You only process files that match that pattern for pg_logfiles_ls()
(perhaps this should be pg_logdir_ls for consistency). And you can then
process the timestamp field in queries. Good idea. What happens if a
filename matches the above pattern but isn't a valid timestamp? Does
the function fail?

My only question is whether we need to allow a custom prefix for the
log filenames so they can be distinguished from other file names in a
user-supplied log directory, like /var/log, or would they always go into
a separate directory under there. I think a prefix would be nice.

Of course this needs docs but I assume you are waiting to see it applied
first.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-07-20 03:49:07 Re: Show tablespace name in pg_tables and pg_indexes
Previous Message David Fetter 2004-07-20 03:07:10 Docs for PL/Perl