Skip site navigation (1) Skip section navigation (2)

log_duration / log_min_duration_statement differences between 8.1.8 and 8.2.4

From: scottb(at)intercastingcorp(dot)com
To: pgsql-admin(at)postgresql(dot)org
Subject: log_duration / log_min_duration_statement differences between 8.1.8 and 8.2.4
Date: 2007-09-26 16:16:33
Message-ID: 48528.192.168.1.70.1190823393.webmail@192.168.1.70 (view raw or flat)
Thread:
Lists: pgsql-admin
Hi,

We're starting to migrate from postgres 8.1.8 to 8.2.4
and noticing behavioral differences in what they log (via syslog to /var/log/pgsql)

The behavior we have on 8.1.8 is:
* log all data-modification queries (with duration)
* log all queries that take longer than 1000 millisec (with duration)


We'd like to have that behavior on 8.2.x as well.

Instead we're getting:
* log all data-modification queries (with duration)
* log all queries that take longer than 1000 millisec (with duration)
  PLUS
*  (unwanted)  log durations only for fast, non-mod queries
example:
Sep 26 09:03:50 db02 postgres[3882]: [78-1] db=our_db; user=app_writer; host=a.b.c.d; LOG:  duration: 0.030 ms

When I set 
    log_duration = off
I avoid the unwanted durations of fast SELECTs, but also lose the durations of the data-modification queries.

* log all data-modification queries (  WITHOUT   duration)
* log all queries that take longer than 1000 millisec (with duration)


Any suggestions ?

 - scottb



    from our 8.1.8 postgresql.conf:

#---------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#---------------------------------------------------------------------------

# - Where to Log -
log_destination = 'syslog'
redirect_stderr = off

#silent_mode = off

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'

# - When to Log -
client_min_messages = warning
log_min_messages = warning
log_error_verbosity = default
log_min_error_statement = error
log_min_duration_statement  = 1000

# - What to Log -
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = off

log_connections = on
#log_disconnections = off
log_duration  = on
log_line_prefix = 'db=%d; user=%u; host=%h; '

log_statement = 'mod'



    from our postgres 8.2.4   postgresql.conf:

#---------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#---------------------------------------------------------------------------

# - Where to Log -
log_destination = 'syslog'
redirect_stderr = off

#silent_mode = off

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'

# - When to Log -
client_min_messages = warning
log_min_messages = warning
log_error_verbosity = default
log_min_error_statement = error
log_min_duration_statement = 1000

# - What to Log -
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = off

log_connections = on
#log_disconnections = off


log_duration = off    ##  logs just the queries we want (mod + slow), but without durations
##  XOR
log_duration = on     ##  logs the queries we want, with durations, PLUS duration loglines for all the fast SELECTs


log_line_prefix = 'db=%d; user=%u; host=%h; '

log_statement = 'mod'



Responses

pgsql-admin by date

Next:From: =?shift-jis?B?c2F0b21p?=Date: 2007-09-27 16:59:14
Subject: 金山です。
Previous:From: Simon RiggsDate: 2007-09-25 18:28:55
Subject: Re: Restarting standby database have to reaply WAL (redologs)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group