pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Definitive logrotate solution?
4+ messages / 2 participants
[nested] [flat]

* Definitive logrotate solution?
@ 2012-04-11 22:20 Wells Oliver <wellsoliver@gmail.com>
  2012-04-11 23:03 ` Re: Definitive logrotate solution? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Wells Oliver @ 2012-04-11 22:20 UTC (permalink / raw)
  To: pgsql-admin

Might anyone share theirs? My log_rotation is set to 'stderr', and the log
files are being put into /var/log/postgresql.

My main concern is the postrotate action-- want to make sure the log is
properly rotated, unneeded older logs removed, and postgres... properly
bounced?

Thanks for any tips.

-- 
Wells Oliver
wellsoliver@gmail.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Definitive logrotate solution?
  2012-04-11 22:20 Definitive logrotate solution? Wells Oliver <wellsoliver@gmail.com>
@ 2012-04-11 23:03 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-04-11 23:40   ` Re: Definitive logrotate solution? Wells Oliver <wellsoliver@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2012-04-11 23:03 UTC (permalink / raw)
  To: Wells Oliver <wellsoliver@gmail.com>; +Cc: pgsql-admin

Wells Oliver <wellsoliver@gmail.com> writes:
> Might anyone share theirs? My log_rotation is set to 'stderr', and the log
> files are being put into /var/log/postgresql.

> My main concern is the postrotate action-- want to make sure the log is
> properly rotated, unneeded older logs removed, and postgres... properly
> bounced?

Use the logging collector with its built-in rotation parameters, and you
don't need anything else.

If you insist on an external solution, there's basically no way except
to shut down and restart postgres after any rotation, because there are
going to be N processes all connected to the same stderr file descriptor.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Definitive logrotate solution?
  2012-04-11 22:20 Definitive logrotate solution? Wells Oliver <wellsoliver@gmail.com>
  2012-04-11 23:03 ` Re: Definitive logrotate solution? Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-04-11 23:40   ` Wells Oliver <wellsoliver@gmail.com>
  2012-04-11 23:51     ` Re: Definitive logrotate solution? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Wells Oliver @ 2012-04-11 23:40 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

How do you ensure you're not keeping logs from 35+ days ago, or whatever?
Just a find -mtime +10 -exec rm {}\; kind of thing?

On Wed, Apr 11, 2012 at 4:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Wells Oliver <wellsoliver@gmail.com> writes:
> > Might anyone share theirs? My log_rotation is set to 'stderr', and the
> log
> > files are being put into /var/log/postgresql.
>
> > My main concern is the postrotate action-- want to make sure the log is
> > properly rotated, unneeded older logs removed, and postgres... properly
> > bounced?
>
> Use the logging collector with its built-in rotation parameters, and you
> don't need anything else.
>
> If you insist on an external solution, there's basically no way except
> to shut down and restart postgres after any rotation, because there are
> going to be N processes all connected to the same stderr file descriptor.
>
>                        regards, tom lane
>



-- 
Wells Oliver
wellsoliver@gmail.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Definitive logrotate solution?
  2012-04-11 22:20 Definitive logrotate solution? Wells Oliver <wellsoliver@gmail.com>
  2012-04-11 23:03 ` Re: Definitive logrotate solution? Tom Lane <tgl@sss.pgh.pa.us>
  2012-04-11 23:40   ` Re: Definitive logrotate solution? Wells Oliver <wellsoliver@gmail.com>
@ 2012-04-11 23:51     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2012-04-11 23:51 UTC (permalink / raw)
  To: Wells Oliver <wellsoliver@gmail.com>; +Cc: pgsql-admin

Wells Oliver <wellsoliver@gmail.com> writes:
> How do you ensure you're not keeping logs from 35+ days ago, or whatever?
> Just a find -mtime +10 -exec rm {}\; kind of thing?

Well, that depends on what you want to do.  I like to choose the log file
names so that they'll automatically be reused once a week or month.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2012-04-11 23:51 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 22:20 Definitive logrotate solution? Wells Oliver <wellsoliver@gmail.com>
2012-04-11 23:03 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-04-11 23:40   ` Wells Oliver <wellsoliver@gmail.com>
2012-04-11 23:51     ` Tom Lane <tgl@sss.pgh.pa.us>

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