Re: PG Log MultiLine Records

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Arvind Singh *EXTERN*" <arvindps(at)hotmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG Log MultiLine Records
Date: 2012-09-21 12:02:32
Message-ID: D960CB61B694CF459DCFB4B0128514C20874B630@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Arvind Singh wrote:
> we have been working on a CSV Log parser application in csharp.
>
> we recently discovered that certain log entries or records can span
across multiple lines.
>
> in the sense, that the same activity has more detail in subsequent
lines.

Not really, they are different log entries that belong to one
SQL statement.

For example, if you have log_statement='all' and
log_min_duration_statement=3s, then some statements will
produce one log entry and others will produce two.

> For ex, a select,insert query has
> A query entry
> A Duration entry
> A Stats entry
>
> and that is why there was a serious coding mistake in counting select
entries, because the same select
> statement
> is displayed in Query column twice and once in Detail column
>
> So our application counted them as three queries.
>
> My query is, has any of us come across more such examples or
> :: is there a link or page explaining type of Log entries

Not really, the details are in the code.

> :: Number of log statements a logentry type occupy.

I don't quite understand that.

> :: or other finer details that we may overlook
>
> it will be helpfull as we wish to release this application for all pg
users at no price.

It is hard to find a solution that works no matter how
logging is configured.

It would be helpful to know what your program is trying to achieve.

What I did for pgreplay is
a) force certain configuration settings as prerequisite
(like log_statement='all').
b) search for log lines with severity "LOG" where the query
entry begins with "statement: ".

That should filter out the "duration" and "stats" lines you
mention above.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2012-09-21 12:50:52 Re: Why csvlog logs contexts without leading tab?
Previous Message Arvind Singh 2012-09-21 11:16:37 PG Log MultiLine Records