diff --git a/ChangeLog b/ChangeLog index 661ac0b..e54baac 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.7.0 (beta), 2009-03-26 - Added support for dynamic filenames in disk logstream by using replacement characters. See the doc for details. diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 4b42bba..f1ba45c 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 @@ -1224,21 +1228,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 d8d3e2a..77d2549 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 @@ -1224,20 +1229,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); } /* 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"; 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";