SCM

[#1010614] HINT: anywhere in the line produces a parse failure

View Trackers | Bugs | Download .csv | Monitor

Date:
2009-04-30 04:54
Priority:
3
State:
Open
Submitted by:
Russell Smith (mr-russ)
Assigned to:
Guillaume Smet (gsmet)
Category:
Group:
Resolution:
None
 
Summary:
HINT: anywhere in the line produces a parse failure

Detailed description
1000795 Missing method QueryLogObject::appendDetail()
1010210 Two bugs with parsing "HINT:" and "free space" lines
1010445 Pgfouine error

All appear to have the same base bug. The logline parser is finding a keyword in the wrong location on the line. The following is my example of how to produce this.

PHP Fatal error: Call to undefined method QueryLogObject::appendHint() in /web/htdocs/bsusas/pgfouine-1.1/include/postgresql/lines/PostgreSQLHintLine.class.php on line 28

Error. This is with the latest 1.1, just downloaded.

Logfile is attached as break.log

Followup

Message
Date: 2009-05-04 22:38
Sender: Guillaume Smet

We can probably work around this problem by implementing an appendHint method to QueryLogObject which appends the text to the query. It's quite ugly and I suppose we'll have the same problem with other patterns (DETAIL: seems to be a problem too).

I can't see a clean way to fix it apart from contraining the log_line_prefix. It's quite easy to fix it for the stderr output but impossible for the syslog output as HINT: lines are exactly identical to lines containing 'HINT:'.

For example, I have the following line in one of my log files:
Dec 11 06:36:28 toucostaud postgres[1205]: [17077-2] db=pgbench,user=postgres HINT: Check free disk space.
It's an HINT but it could be part of a query too.

Any idea/opinion/comment out there?
Date: 2009-05-04 22:24
Sender: Guillaume Smet

Hi Russell,

The regexp is liberal to be able to catch the log line prefix. Note that the (.*?) at the start of the line is a non greedy pattern so it's not that liberal.

What is important to know here is that at this point of the parser, pgFouine treats each line separately.

That said, it needs to be fixed. It's not just as simple as it seems. I'll see what I can do to fix the problem.

--
Guillaume
Date: 2009-04-30 05:03
Sender: Russell Smith

The following regexp in
include/postgresql/PostgreSQLRegexps.lib.php appears to
liberal for multi-line SQL logging. the keyword should be
the first thing part of the general query, not anywhere in
the string.
It should detect the prefix of the line and then ensure HINT
is the next thing

$postgreSQLRegexps['LogLine'] = new
RegExp("/^(.*?)(LOG|DEBUG|CONTEXT|WARNING|ERROR|FATAL|PANIC|HINT|DETAIL|NOTICE|STATEMENT|INFO|LOCATION):[\s]+(?:[0-9XPFDBLA]{2}[0-9A-Z]{3}:[\s]+)?/");

Attached Files:

Attachments:
break.log

Changes:

Field Old Value Date By
assigned_tonone2009-05-04 05:55gsmet
File Added398: break.log2009-04-30 04:57mr-russ
Powered By FusionForge