From cde0308016fdc195310c0925d9062f3aa99f9ab3 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 29 Apr 2009 16:46:34 +0200 Subject: [PATCH 1/4] Fixed a bug detection syslog facily, severity and messagetype fields on index site. This could cause these fields to be represented numeric instead of huma readable. --- src/index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.php b/src/index.php index ff91ad1..6040fe3 100644 --- a/src/index.php +++ b/src/index.php @@ -382,7 +382,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // Special style classes and colours for SYSLOG_FACILITY if ( $mycolkey == SYSLOG_FACILITY ) { - if ( isset($logArray[$mycolkey][SYSLOG_FACILITY]) && strlen($logArray[$mycolkey][SYSLOG_FACILITY]) > 0) +// if ( isset($logArray[$mycolkey][SYSLOG_FACILITY]) && strlen($logArray[$mycolkey][SYSLOG_FACILITY]) > 0) + if ( isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey]) ) { $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $facility_colors[ $logArray[SYSLOG_FACILITY] ] . '" '; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = "lineColouredBlack"; @@ -401,7 +402,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) } else if ( $mycolkey == SYSLOG_SEVERITY ) { - if ( isset($logArray[$mycolkey][SYSLOG_SEVERITY]) && strlen($logArray[$mycolkey][SYSLOG_SEVERITY]) > 0) +// if ( isset($logArray[$mycolkey][SYSLOG_SEVERITY]) && strlen($logArray[$mycolkey][SYSLOG_SEVERITY]) > 0) + if ( isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey]) ) { $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[ $logArray[SYSLOG_SEVERITY] ] . '" '; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = "lineColouredWhite"; @@ -420,7 +422,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { - if ( isset($logArray[$mycolkey][SYSLOG_MESSAGETYPE]) ) +// if ( isset($logArray[$mycolkey][SYSLOG_MESSAGETYPE]) ) + if ( isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey]) ) { $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $msgtype_colors[ $logArray[SYSLOG_MESSAGETYPE] ] . '" '; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = "lineColouredBlack"; From 542c988556ca448f69f52f3135773246657a5549 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 29 Apr 2009 16:54:56 +0200 Subject: [PATCH 2/4] Fixed a bug in the detail page which could lead to missing numeric fields --- src/details.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/details.php b/src/details.php index b0c7289..bbe63cc 100644 --- a/src/details.php +++ b/src/details.php @@ -185,7 +185,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' $counter = 0; foreach($content['fields'] as $mycolkey => $myfield) { - if ( isset($logArray[$mycolkey]) && ( is_array($logArray[$mycolkey]) || (is_string($logArray[$mycolkey]) && strlen($logArray[$mycolkey]) > 0)) ) + if ( isset($logArray[$mycolkey]) && ( is_array($logArray[$mycolkey]) || (is_string($logArray[$mycolkey]) && strlen($logArray[$mycolkey]) > 0)) || (is_numeric($logArray[$mycolkey])) ) { $content['fields'][$mycolkey]['fieldenabled'] = true; @@ -220,7 +220,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' // Special style classes and colours for SYSLOG_FACILITY if ( $mycolkey == SYSLOG_FACILITY ) { - if ( isset($logArray[$mycolkey][SYSLOG_FACILITY]) && strlen($logArray[$mycolkey][SYSLOG_FACILITY]) > 0) +// if ( isset($logArray[$mycolkey][SYSLOG_FACILITY]) && strlen($logArray[$mycolkey][SYSLOG_FACILITY]) > 0) + if ( isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey]) ) { $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $facility_colors[ $logArray[SYSLOG_FACILITY] ] . '" '; $content['fields'][$mycolkey]['cssclass'] = "lineColouredBlack"; @@ -236,7 +237,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' } else if ( $mycolkey == SYSLOG_SEVERITY ) { - if ( isset($logArray[$mycolkey][SYSLOG_SEVERITY]) && strlen($logArray[$mycolkey][SYSLOG_SEVERITY]) > 0) +// if ( isset($logArray[$mycolkey][SYSLOG_SEVERITY]) && strlen($logArray[$mycolkey][SYSLOG_SEVERITY]) > 0) + if ( isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey]) ) { $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[ $logArray[SYSLOG_SEVERITY] ] . '" '; $content['fields'][$mycolkey]['cssclass'] = "lineColouredWhite"; @@ -252,7 +254,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { - if ( isset($logArray[$mycolkey][SYSLOG_MESSAGETYPE]) ) +// if ( isset($logArray[$mycolkey][SYSLOG_MESSAGETYPE]) ) + if ( isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey]) ) { $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $msgtype_colors[ $logArray[SYSLOG_MESSAGETYPE] ] . '" '; $content['fields'][$mycolkey]['cssclass'] = "lineColouredBlack"; From ebe93ace8cfbe2bf2077c0b7937a9da251cdd018 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 29 Apr 2009 17:13:41 +0200 Subject: [PATCH 3/4] Added support for debug output in Cleanup routine of mysql and pdo logstreams. --- src/classes/logstreamdb.class.php | 28 +++++++++++++--------------- src/classes/logstreampdo.class.php | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index cd671d3..41a5201 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -657,7 +657,6 @@ class LogStreamDB extends LogStream { // Set default rowcount $rowcount = null; - // Perform if Connection is true! if ( $this->_dbhandle != null ) { @@ -678,6 +677,11 @@ class LogStreamDB extends LogStream { // Free result not needed here! //mysql_free_result ($myQuery); } + else + { + // error occured, output DEBUG message + $this->PrintDebugError("CleanupLogdataByDate failed with SQL Statement ' " . $szSql . " '"); + } } //return affected rows @@ -1212,21 +1216,15 @@ class LogStreamDB extends LogStream { */ private function PrintDebugError($szErrorMsg) { - if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) - { - $errdesc = mysql_error(); - $errno = mysql_errno(); + $errdesc = mysql_error(); + $errno = mysql_errno(); - $errormsg="Database error: $szErrorMsg
"; - $errormsg.="mysql error: $errdesc
"; - $errormsg.="mysql error number: $errno
"; - $errormsg.="Date: ".date("d.m.Y @ H:i"). "
"; - $errormsg.="Script: ".getenv("REQUEST_URI"). "
"; - $errormsg.="Referer: ".getenv("HTTP_REFERER"). "
"; - - //Output! - OutputDebugMessage("LogStreamDB|CreateMainSQLQuery: $errormsg", DEBUG_ERROR); - } + $errormsg="$szErrorMsg
"; + $errormsg.="Detail error: $errdesc
"; + $errormsg.="Error Code: $errno
"; + + //Output! + OutputDebugMessage("LogStreamDB|PrintDebugError: $errormsg", DEBUG_ERROR); } /* diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index 67cffc8..3147af3 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -669,6 +669,11 @@ class LogStreamPDO extends LogStream { // Free query now $myQuery->closeCursor(); } + else + { + // error occured, output DEBUG message + $this->PrintDebugError("CleanupLogdataByDate failed with SQL Statement ' " . $szSql . " '"); + } } //return affected rows @@ -1182,20 +1187,15 @@ class LogStreamPDO extends LogStream { */ private function PrintDebugError($szErrorMsg) { - if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) - { - $errdesc = $this->_dbhandle == null ? "" : implode( ";", $this->_dbhandle->errorInfo() ); - $errno = $this->_dbhandle == null ? "" : $this->_dbhandle->errorCode(); + $errdesc = $this->_dbhandle == null ? "" : implode( ";", $this->_dbhandle->errorInfo() ); + $errno = $this->_dbhandle == null ? "" : $this->_dbhandle->errorCode(); - $errormsg ="Error: " . $szErrorMsg . "
"; - $errormsg.="Errordetails:
"; - $errormsg.="Detail Error: $errdesc
"; - $errormsg.="Error Code: $errno
"; - $errormsg.="Date: ".date("d.m.Y @ H:i"). "
"; - - //Output! - OutputDebugMessage("LogStreamPDO|CreateMainSQLQuery: $errormsg", DEBUG_ERROR); - } + $errormsg="$szErrorMsg
"; + $errormsg.="Detail error: $errdesc
"; + $errormsg.="Error Code: $errno
"; + + //Output! + OutputDebugMessage("LogStreamPDO|PrintDebugError: $errormsg", DEBUG_ERROR); } /* From 8f57974ff63ec299899bbbf02acbb6efa709ca84 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 29 Apr 2009 17:17:44 +0200 Subject: [PATCH 4/4] Added changelog entry --- ChangeLog | 9 +++++++++ src/include/functions_common.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c6ae7c5..2f5edcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ --------------------------------------------------------------------------- +Version 2.6.3 (v2-stable), 2009-04-29 +- Fixed a bug that caused fields like syslog facily, severity or + messagetype to be shown numeric instead of readable + coloured replacements. +- Fixed a bug in the detail page which could cause numeric fields + to be missing. +- Added support for debug output in the data cleanup routine of + mysql and pdo logstreams. This will help troubleshooting. +--------------------------------------------------------------------------- Version 2.6.2 (v2-stable), 2009-03-24 - Fixed minor spelling errors in language files (BugID #115) - Fixed number of records exported when using the export (BugID #110). diff --git a/src/include/functions_common.php b/src/include/functions_common.php index d1a6616..9045f9a 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -66,7 +66,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.6.2"; +$content['BUILDNUMBER'] = "2.6.3"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['SHOW_DONATEBUTTON'] = true; // Default = true!