Re: LogFile Management

From: Shane Ambler <pgsql(at)Sheeky(dot)Biz>
To: Peter Elmers <p(dot)elmers(at)gmx(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: LogFile Management
Date: 2007-03-20 13:35:30
Message-ID: 45FFE322.5070303@Sheeky.Biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Peter Elmers wrote:
> Hi!
>
> After countless tries for configuring postgres logmanagement without
> success, i hope the community can help me solving the following problem:
>
> I would like to have postgres write logfiles, which must not exceed a
> specific size all together. After the files have reached the desired
> size, it would be nice that the files will
>
> a) be overwritten or
> b) rotate and are overwritten after reaching the limit of file numbers.

Pretty sure there is no such option within postgresql.
The log settings are to simply provide a maximum file size for each log
to make them easier to manage when you want to look at recent activity,
not to remove old log files which is more of a sysadmin task.

I would suggest you look at something like the steps you can find in
/etc/daily and adjust to your log names. The steps that exist there can
point you to ways of finding files greater than a certain age (the find
using the atime option near the start) and rotating to have a certain
number of log files as shown near the end for rotating the system.log
which also compresses the old log files. If you have postgresql changing
log files by size (log_rotation_size = 1MB) then the number of files in
the log dir will give you the rough total size or you may want to use du
to get the disk space used by the log dir.

The common way to handle this would be create a shell script (or perl if
that is your preference) with the steps you want and then have cron run
them on a regular basis. I have used Cronnix for a few years now which
can make that step easier.
http://h5197.serverkompetenz.net:9080/abstracture_public/projects-en/cronnix/

If you are new to using the terminal then I suggest you use the
available man pages to find the options that meet your needs for the
steps you want. If you have the Apple dev tools installed with docs then
you can also find them in xcode's help (find man page...) also Apple has
a shell scripting tutorial which you can find -
/Developer/ADC Reference
Library/documentation/OpenSource/Conceptual/ShellScripting/index.html
or online at -
http://developer.apple.com/documentation/OpenSource/Conceptual/ShellScripting/index.html

--

Shane Ambler
pgSQL(at)Sheeky(dot)Biz

Get Sheeky @ http://Sheeky.Biz

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David Monarchi 2007-03-20 17:51:48 Very long times to build hash indexes
Previous Message Peter Elmers 2007-03-20 09:19:39 LogFile Management