positive time offset parsing bug in function GetEventTime

Diskussions related to the development of PhpLogCon

Google Ads


positive time offset parsing bug in function GetEventTime

Postby stephane.gauthier » Wed Apr 06, 2011 8:21 pm

I was testing the addition of my apache weblogs to loganalyzer and noticed it was showing all my entries as 1969 (or some default value).
After turning on the very useful debug mode I immediately noticed the timestamp was reported as "invalid".

A closer look at GetEventTime in functions_common.php quickly showed a bunch of TODO related to the use of date_default_timezone_get() so I thought it was because of that but it wasn't the case as my timezone is configured properly.

My message's timestamp was of the type: "16/Sep/2008:13:37:47 -0200"... and judging by the following lines of the GetEventTime function, the regex only expect positive time offsets.

Code: Select all
// Sample: 16/Sep/2008:13:37:47 +0200
else if ( preg_match("/([0-9]{1,2})\/(...)\/([0-9]{1,4}):([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}) \-([0-9]{1,4})/", $szTimStr, $out ) )


so after updating regex to:

Code: Select all
else if ( preg_match("/([0-9]{1,2})\/(...)\/([0-9]{1,4}):([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}) [+-]([0-9]{1,4})/", $szTimStr, $out ) )


It started working...

I'm not sure if that's the correct way to do it or if it's even a bug but just wanted to report it here for potential inclusion in the next update.

I welcome any feedback.

Thanks for the excellent product,
Stephane
stephane.gauthier
New
 
Posts: 8
Joined: Mon Mar 21, 2011 2:41 pm

Urgent Question?

  • Pulling out your Hair?
  • Wasting Time and Money?
  • Deadline Approaching?

Re: positive time offset parsing bug in function GetEventTim

Postby alorbach » Tue Apr 12, 2011 3:20 pm

Thanks for your post. There was indeed some work from the initial loganalyzer days to be done there ;).
I have looked at the GetEventTime function and fixed it to support positive and negativ time offsezs properly.
Please try LogAnalyzer 3.2.1, it should fix the problem for you:
http://loganalyzer.adiscon.com/download ... -v3-stable

best regards,
Andre Lorbach
alorbach
Site Admin
 
Posts: 1627
Joined: Thu Feb 13, 2003 11:55 am

Re: positive time offset parsing bug in function GetEventTim

Postby stephane.gauthier » Wed Apr 13, 2011 8:32 pm

Thanks for the quick fix. Works like a charm...

Stephane
stephane.gauthier
New
 
Posts: 8
Joined: Mon Mar 21, 2011 2:41 pm

Google Ads



Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 1 guest

cron