Re: [HACKERS] more contrib: log rotator

2003-04-05 Thread Jon Jensen
On Fri, 4 Apr 2003, Tom Lane wrote: > 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... It's written in 140 lines of C (blank lines and all), and has been very solid in my exper

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> 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

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Peter Eisentraut
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. > If someone can offer a be

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Tom Lane wrote: > "scott.marlowe" <[EMAIL PROTECTED]> writes: > > Hey, do you guys think that a setting of silent_mode = false might affect > > no log files getting created? > > No, but setting it to true would be bad news. That's what I'd meant actually. I had to turn of s

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Tom Lane
"scott.marlowe" <[EMAIL PROTECTED]> writes: > Hey, do you guys think that a setting of silent_mode = false might affect > no log files getting created? No, but setting it to true would be bad news. regards, tom lane ---(end of broadcast)-

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Ed L. wrote: > On Friday April 4 2003 2:17, scott.marlowe wrote: > > > > OK, So I tried putting the 2>&1 before the | and all. No matter what I > > try, every from the | on is ignored. ps doesn't show it, and neither > > does pg_ctl status. Both show a command line of > > /u

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Ed L.
On Friday April 4 2003 2:17, scott.marlowe wrote: > > OK, So I tried putting the 2>&1 before the | and all. No matter what I > try, every from the | on is ignored. ps doesn't show it, and neither > does pg_ctl status. Both show a command line of > /usr/local/pgsql/bin/postmaster as the only inpu

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Ed L. wrote: > On Friday April 4 2003 11:58, Tom Lane wrote: > > "scott.marlowe" <[EMAIL PROTECTED]> writes: > > > rotatelogs is in my path and all, it just never sees it. > > > > You mean the command fails? Or just that it doesn't capture output? > > > > > "$po_path" ${1+"$@"

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Tom Lane
"Ed L." <[EMAIL PROTECTED]> writes: > Hmmm. I would have agreed 2>&1 was needed, too, but this command seems to > routinely capture all output, including ERRORs: > nohup pg_ctl start | nohup rotatelogs server_log.%a 86400 That's 'cause pg_ctl internally redirects the postmaster's stderr.

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Tom Lane wrote: > "scott.marlowe" <[EMAIL PROTECTED]> writes: > > rotatelogs is in my path and all, it just never sees it. > > You mean the command fails? Or just that it doesn't capture output? The database starts, but rotatelogs doesn't get run. I.e. it's just like every

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Ed L.
On Friday April 4 2003 11:58, Tom Lane wrote: > "scott.marlowe" <[EMAIL PROTECTED]> writes: > > rotatelogs is in my path and all, it just never sees it. > > You mean the command fails? Or just that it doesn't capture output? > > > "$po_path" ${1+"$@"} > 2>&1 & > > Most if not all of the postmaste

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Tom Lane
"scott.marlowe" <[EMAIL PROTECTED]> writes: > rotatelogs is in my path and all, it just never sees it. You mean the command fails? Or just that it doesn't capture output? > "$po_path" ${1+"$@"} &1 & Most if not all of the postmaster's log output goes to stderr, so you'd need "$po_path" ${1+"$@

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Ed L. wrote: > On Friday April 4 2003 10:19, Tom Lane wrote: > > > > I feel we really ought to have *some* rotator included in the standard > > distro, just so that the Admin Guide can point to a concrete solution > > instead of having to arm-wave about what you can get off the

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Ed L.
On Friday April 4 2003 10:19, Tom Lane wrote: > > I feel we really ought to have *some* rotator included in the standard > distro, just so that the Admin Guide can point to a concrete solution > instead of having to arm-wave about what you can get off the net. > If someone can offer a better altern

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > What would get me a whole lot more excited is if the server could write > directly to a file and do its own rotating (or at least reopening of > files). AFAICS, the only practical way to do this is to have a single process collecting the stdout/stderr

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Andrew Sullivan wrote: > On Fri, Apr 04, 2003 at 09:16:39AM -0700, scott.marlowe wrote: > > where -r is the rotation period in seconds. If it's an external program > > Ours rotates based on size rather than time. I can see some > advantages to the time-based approach, but i

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Jan Wieck
Peter Eisentraut wrote: > > Andrew Sullivan writes: > > > Is anyone interested in having pglog-rotator? > > What would get me a whole lot more excited is if the server could write > directly to a file and do its own rotating (or at least reopening of > files). >From a technical point of view I

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Ed L.
On Friday April 4 2003 10:04, Ed L. wrote: > By way of feature ideas, one very convenient but not widely used feature > of Apache's log rotator is the ability to specify a strftime() format > string for the file extension. For example, if I want to have my logs > rollover every 24 hours and be nam

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Ed L.
On Friday April 4 2003 9:16, scott.marlowe wrote: > > That said, a log rotation capability built right into pg_ctl or > thereabouts would be a very nice feature. I.e. 'pg_ctl -r 86400 -l > $PGDATA/logs/pgsql start' > > where -r is the rotation period in seconds. If it's an external program > that

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Andrew Sullivan
On Fri, Apr 04, 2003 at 05:13:13PM +0200, Peter Eisentraut wrote: > use of pg_ctl, it's written in Perl, and it doesn't do anything for > Windows users, I think it's not suitable for a general audience. It doesn't prevent the use of pg_ctl, although it does indeed prevent the use of pg_ctl for sta

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Andrew Sullivan
On Fri, Apr 04, 2003 at 09:16:39AM -0700, scott.marlowe wrote: > where -r is the rotation period in seconds. If it's an external program Ours rotates based on size rather than time. I can see some advantages to the time-based approach, but if you have wide variations in traffic, you run the ris

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread scott.marlowe
On Fri, 4 Apr 2003, Peter Eisentraut wrote: > Andrew Sullivan writes: > > > Is anyone interested in having pglog-rotator? > > What would get me a whole lot more excited is if the server could write > directly to a file and do its own rotating (or at least reopening of > files). > > Considering

Re: [HACKERS] more contrib: log rotator

2003-04-04 Thread Peter Eisentraut
Andrew Sullivan writes: > Is anyone interested in having pglog-rotator? What would get me a whole lot more excited is if the server could write directly to a file and do its own rotating (or at least reopening of files). Considering that your rotator is tailored to a rather specific setup, it do

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Andrew Sullivan
On Thu, Apr 03, 2003 at 01:41:08PM -0500, Tom Lane wrote: > Andrew, could you toss up the script on pgsql-patches just so people can > take a look? Then we could think more about where to go with it. Ok, the first try failed (of course) because I wasn't subscribed. Should be there now, though.

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Andrew Sullivan
On Thu, Apr 03, 2003 at 02:12:03PM -0500, Dave Cramer wrote: > Does this log rotator do something that apache's doesn't? Probably not. This was just easier for us. A little information might be handy here: we run postgres nder a hosted environment, and we do not have root on the relevant boxes.

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Andrew Sullivan
On Thu, Apr 03, 2003 at 01:41:08PM -0500, Tom Lane wrote: > You would not actually have to: you could just pipe pg_ctl's output to > pglog-rotator. But I think it'd be cool if pg_ctl had an option to use > pglog-rotator, or maybe even adopt it as standard behavior. It's currently built to call a

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Dave Cramer
Does this log rotator do something that apache's doesn't? Dave On Thu, 2003-04-03 at 13:41, Tom Lane wrote: > "Jim Buttafuoco" <[EMAIL PROTECTED]> writes: > > Would the plan be to add it to pg_ctl? > > You would not actually have to: you could just pipe pg_ctl's output to > pglog-rotator. But I

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Tom Lane
"Jim Buttafuoco" <[EMAIL PROTECTED]> writes: > Would the plan be to add it to pg_ctl? You would not actually have to: you could just pipe pg_ctl's output to pglog-rotator. But I think it'd be cool if pg_ctl had an option to use pglog-rotator, or maybe even adopt it as standard behavior. I think

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Jim Buttafuoco
Would the plan be to add it to pg_ctl? > Andrew Sullivan <[EMAIL PROTECTED]> writes: > > Is anyone interested in having pglog-rotator? > > FWIW, I saw an early version of pglog-rotator about a year and a half > ago (while consulting for LibertyRMS), and thought at the time that > it was pretty c

Re: [HACKERS] more contrib: log rotator

2003-04-03 Thread Tom Lane
Andrew Sullivan <[EMAIL PROTECTED]> writes: > Is anyone interested in having pglog-rotator? FWIW, I saw an early version of pglog-rotator about a year and a half ago (while consulting for LibertyRMS), and thought at the time that it was pretty cool. So I'm for including it ... maybe even as mains

[HACKERS] more contrib: log rotator

2003-04-03 Thread Andrew Sullivan
Since now is the time for contrib/ flamewars, this seemed a good time to suggest this. My colleague, Sorin Iszlai, wrote us a little program for rotating our Postgres logs. It reads stdout and stderr, and sends them to different files (and rotates them as necessary). It is currently hand-configu