pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah@trade-india.com>
To: PGSQL List (E-mail) <pgsql-admin@postgresql.org>
Subject: fishing out LOG: duration lines from the logfile.
Date: Sat, 01 Nov 2003 22:02:29 -0500
Message-ID: <3FA473C5.3020509@trade-india.com> (raw)


Hi,

I think its not going to a trivial task to take out only the LOG duration
lines from a PostgreSQL logfile. We need to extract the duration and
the actual statement. I think i will put a custom delimeters around the
statements for the time being so that the log parser can parse it
unambigiously. Is there any better method?


Regds
Mallah.


Example Log file:


LOG:  duration: 3.725 ms  statement: SELECT c.oid,
          n.nspname,
          c.relname
        FROM pg_catalog.pg_class c
             LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
        WHERE pg_catalog.pg_table_is_visible(c.oid)
              AND c.relname ~ '^users$'
        ORDER BY 2, 3;

other log messages
other log messages
other log messages


LOG:  duration: 0.705 ms  statement: SELECT relhasindex, relkind, 
relchecks, reltriggers, relhasrules
        FROM pg_catalog.pg_class WHERE oid = '17411'
LOG:  duration: 5.929 ms  statement: SELECT a.attname,
          pg_catalog.format_type(a.atttypid, a.atttypmod),
          a.attnotnull, a.atthasdef, a.attnum
        FROM pg_catalog.pg_attribute a
        WHERE a.attrelid = '17411' AND a.attnum > 0 AND NOT a.attisdropped
        ORDER BY a.attnum
LOG:  duration: 0.799 ms  statement: SELECT substring(d.adsrc for 128) 
FROM pg_catalog.pg_attrdef d
        WHERE d.adrelid = '17411' AND d.adnum = 1
LOG:  duration: 0.965 ms  statement: SELECT substring(d.adsrc for 128) 
FROM pg_catalog.pg_attrdef d
        WHERE d.adrelid = '17411' AND d.adnum = 31
LOG:  duration: 0.998 ms  statement: SELECT substring(d.adsrc for 128) 
FROM pg_catalog.pg_attrdef d
        WHERE d.adrelid = '17411' AND d.adnum = 33
LOG:  duration: 2.288 ms  statement: SELECT c2.relname, i.indisprimary, 
i.indisunique, pg_catalog.pg_get_indexdef(i.indexrelid)
        FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, 
pg_catalog.pg_index i
        WHERE c.oid = '17411' AND c.oid = i.indrelid AND i.indexrelid = 
c2.oid
        ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname



LOG:  duration: 2.288 ms  statement: SELECT c2.relname, i.indisprimary, 
i.indisunique, pg_catalog.pg_get_indexdef(i.indexrelid)
        FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, 
pg_catalog.pg_index i
        WHERE c.oid = '17411' AND c.oid = i.indrelid AND i.indexrelid = 
c2.oid
        ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname 
:statement end (<-- custom delimit)

view thread (2+ messages)

Message-ID: <3FA473C5.3020509@trade-india.com>
Permalink:  ../3FA473C5.3020509@trade-india.com/
Also on:    postgresql.org/message-id/3FA473C5.3020509@trade-india.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mallah@trade-india.com
  Subject: Re: fishing out LOG: duration lines from the logfile.
  In-Reply-To: <3FA473C5.3020509@trade-india.com>
  References: <3FA473C5.3020509@trade-india.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox