circular stderr logging - truncation issue

From: vk <vk(dot)mlists(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: circular stderr logging - truncation issue
Date: 2008-09-27 00:43:12
Message-ID: 48DD81A0.1010104@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everyone!
I'm trying to implement circular stderr logging:
postgresql 8.3.4 compiled from src
fedora 6 x86_64, Intel Core 2 Duo, 2GB RAM
/usr/local/pgsql/ partition mounted noatime

based on the following document managing circular/logging should be
possible:
http://www.postgresql.org/docs/current/static/runtime-config-logging.html

however, I'm unable to implement it the way it is described on that
page, pg_logs/ logs just keep on appending and not truncating as needed:

here are my logging settings (grep "^log_" and grep "^#log_"
postgresql.conf ):

#log_destination = 'stderr' # Valid values are combinations of
#log_directory = 'pg_log' # directory where log files are
written,
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name
pattern,
#log_min_messages = notice # values in order of decreasing
detail:
#log_error_verbosity = default # terse, default, or verbose
messages
#log_min_error_statement = error # values in order of decreasing
detail:
#log_checkpoints = off
#log_connections = off
#log_disconnections = off
#log_duration = off
#log_hostname = off
#log_lock_waits = off # log lock waits >= deadlock_timeout
#log_statement = 'none' # none, ddl, mod, all
#log_temp_files = -1 # log temporary files equal or
larger
#log_timezone = unknown # actually, defaults to TZ
environment
#log_parser_stats = off
#log_planner_stats = off
#log_executor_stats = off
#log_statement_stats = off
log_filename = 'postgresql.log.%S'
log_truncate_on_rotation = on # If on, an existing log file of the
log_rotation_age = 1min # Automatic rotation of logfiles
will
log_rotation_size = 10MB # Automatic rotation of logfiles
will
log_min_duration_statement = 0 # -1 is disabled, 0 logs all statements
log_line_prefix = '%t [%p]: [%l-1] %h ' # special values:
log_autovacuum_min_duration = 0 # -1 disables, 0 logs all
actions and

note the above config is prof of concept only, I'm not going to rotate
logs every second on production.
for production I intend to have
"log_rotation_age = 1 h"
"log_filename = postgresql.log.%M"

I'm using pgbench to generate db/logs traffic:

while (true); do date; pgbench -s 5000 -c 10 -t 5000 PGBENCH; done

meanwhile watching pg_log dir:

after 50 minutes or so of this testing I never saw any log file to drop
in size. after looking through individual log files, I confirm that old
data is still there, and new data is just appended at the bottom.

how can I get truncate to work properly in this setup ? could you point
me in the right direction ?
or could this be a bug ..

Thanks !
Vlad

Responses

Browse pgsql-general by date

  From Date Subject
Next Message vk 2008-09-27 01:11:18 Re: circular stderr logging - truncation issue
Previous Message Ralph Smith 2008-09-27 00:06:37 Re: Using a User-Def function in a query