Re: circular stderr logging - truncation issue - Mailing list pgsql-general
From | vk |
---|---|
Subject | Re: circular stderr logging - truncation issue |
Date | |
Msg-id | 48DD8836.9070106@gmail.com Whole thread Raw |
In response to | circular stderr logging - truncation issue (vk <vk.mlists@gmail.com>) |
List | pgsql-general |
note, I tried both with "#log_rotation_size = 10MB " - commented/default, and then enabled it as per documentation page both having similar result - no truncation. there is example on that documentation page that suggests that both size and time based rotation could be possible while truncation is enabled - which seem to contradict configuration's file comments: log_truncate_on_rotation = on # If on, an existing log file of the # same name as the new log file will be # truncated rather than appended to. # But such truncation only occurs on # time-driven rotation, not on restarts # or size-driven rotation. Default is # off, meaning append to existing files # in all cases. Also, in my original post there was a typo: I'm watching pg_log/ dir " , not pg_logs/ dir Thanks! vk wrote: > 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 > >
pgsql-general by date: