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
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_"
#log_destination = 'stderr' # Valid values are combinations of
#log_directory = 'pg_log' # directory where log files are
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name
#log_min_messages = notice # values in order of decreasing
#log_error_verbosity = default # terse, default, or verbose
#log_min_error_statement = error # values in order of decreasing
#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
#log_timezone = unknown # actually, defaults to TZ
#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
log_rotation_size = 10MB # Automatic rotation of logfiles
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
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 ..
pgsql-general by date
|Next:||From: vk||Date: 2008-09-27 01:11:18|
|Subject: Re: circular stderr logging - truncation issue|
|Previous:||From: Ralph Smith||Date: 2008-09-27 00:06:37|
|Subject: Re: Using a User-Def function in a query |