Syslog report: Moved Event Count Row to left

Enhanced Syslog report generation performance. Needed some changes in the basic report class.
This commit is contained in:
Andre Lorbach 2011-10-26 15:54:59 +02:00
parent 0ca9204246
commit 9b95b35c81
6 changed files with 230 additions and 141 deletions

View File

@ -207,7 +207,7 @@ abstract class LogStream {
* *
* @return integer Error stat * @return integer Error stat
*/ */
public abstract function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $bIncludeLogStreamFields = false); public abstract function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $bIncludeLogStreamFields = false, $bIncludeMinMaxDateFields = false);
/** /**
@ -252,6 +252,11 @@ abstract class LogStream {
public abstract function SaveMessageChecksum( $arrProperitesIn ); public abstract function SaveMessageChecksum( $arrProperitesIn );
/*
* Helper function for logstream classes to clear filter based stuff
*/
public abstract function ResetFilters( );
/* /*
* Helper functino to trigger initialisation of MsgParsers * Helper functino to trigger initialisation of MsgParsers
*/ */
@ -276,6 +281,9 @@ abstract class LogStream {
OutputDebugMessage("SetFilter combined = '" . $finalfilters . "'. ", DEBUG_DEBUG); OutputDebugMessage("SetFilter combined = '" . $finalfilters . "'. ", DEBUG_DEBUG);
// Reset Filters first to make sure we do not add multiple filters!
$this->_filters = null;
// Parse Filters from string // Parse Filters from string
$this->ParseFilters($finalfilters); $this->ParseFilters($finalfilters);
@ -585,6 +593,23 @@ abstract class LogStream {
return null; return null;
} }
/*
* Helper function to get the internal Field ID by database field name!
*/
public function GetFieldIDbyDatabaseMapping($szTableType, $szFieldName)
{
global $content, $dbmapping;
foreach( $dbmapping[$szTableType]['DBMAPPINGS'] as $myFieldID => $myDBMapping )
{
if ( $myDBMapping == $szFieldName )
return $myFieldID;
}
// Default return!
return $szFieldName;
}
/* /*
* --- PIRVATE HELPERS! * --- PIRVATE HELPERS!
*/ */
@ -1182,7 +1207,5 @@ abstract class LogStream {
return -1; return -1;
} }
} }
?> ?>

View File

@ -112,6 +112,15 @@ class LogStreamDB extends LogStream {
return SUCCESS; return SUCCESS;
} }
/*
* Helper function to clear the current querystring!
*/
public function ResetFilters()
{
// Clear _SQLwhereClause variable!
$this->_SQLwhereClause = "";
}
/** /**
* Close the database connection. * Close the database connection.
* *
@ -744,7 +753,7 @@ class LogStreamDB extends LogStream {
* *
* @return integer Error stat * @return integer Error stat
*/ */
public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false) public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false, $bIncludeMinMaxDateFields = false)
{ {
global $content, $dbmapping, $fields; global $content, $dbmapping, $fields;
@ -793,13 +802,20 @@ class LogStreamDB extends LogStream {
} }
else // Only Include ConsolidateField else // Only Include ConsolidateField
$myDBQueryFields = $myDBConsFieldName . ", "; $myDBQueryFields = $myDBConsFieldName . ", ";
// Add Min and Max fields for DATE if desired
if ( $bIncludeMinMaxDateFields )
{
$myDBQueryFields .= "Min(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_DATE] . ") as FirstOccurrence_Date, ";
$myDBQueryFields .= "Max(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_DATE] . ") as LastOccurrence_Date, ";
}
if ( $szConsFieldId == $szSortFieldId ) if ( $szConsFieldId == $szSortFieldId )
$myDBSortedFieldName = "ItemCount"; $myDBSortedFieldName = "ItemCount";
else else
$myDBSortedFieldName = $szSortFieldId; $myDBSortedFieldName = $szSortFieldId;
// --- // ---
// Special handling for date fields // Special handling for date fields
if ( $nConsFieldType == FILTER_TYPE_DATE ) if ( $nConsFieldType == FILTER_TYPE_DATE )
{ {
@ -815,7 +831,7 @@ class LogStreamDB extends LogStream {
$szLimitSql = ""; $szLimitSql = "";
// Create SQL Where Clause! // Create SQL Where Clause!
if ( $this->_SQLwhereClause == "" ) if ( strlen($this->_SQLwhereClause) <= 0 )
{ {
$res = $this->CreateSQLWhereClause(); $res = $this->CreateSQLWhereClause();
if ( $res != SUCCESS ) if ( $res != SUCCESS )
@ -832,11 +848,14 @@ class LogStreamDB extends LogStream {
" ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder . " ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder .
$szLimitSql ; $szLimitSql ;
// Output Debug Informations
OutputDebugMessage("LogStreamDB|ConsolidateDataByField: Running Created SQL Query:<br>" . $szSql, DEBUG_DEBUG);
// Perform Database Query // Perform Database Query
$myquery = mysql_query($szSql, $this->_dbhandle); $myquery = mysql_query($szSql, $this->_dbhandle);
if ( !$myquery ) if ( !$myquery )
return ERROR_DB_QUERYFAILED; return ERROR_DB_QUERYFAILED;
// Initialize Array variable // Initialize Array variable
$aResult = array(); $aResult = array();
@ -848,12 +867,17 @@ class LogStreamDB extends LogStream {
foreach ( $myRow as $myFieldName => $myFieldValue ) foreach ( $myRow as $myFieldName => $myFieldValue )
{ {
if ( $myFieldName == $dbmapping[$szTableType]['DBMAPPINGS'][$szConsFieldId] ) $myFieldID = $this->GetFieldIDbyDatabaseMapping($szTableType, $myFieldName);
$aNewRow[ $myFieldID ] = $myFieldValue;
/* if ( $myFieldName == $dbmapping[$szTableType]['DBMAPPINGS'][$szConsFieldId] )
$aNewRow[$szConsFieldId] = $myFieldValue; $aNewRow[$szConsFieldId] = $myFieldValue;
else else
{
$aNewRow[$myFieldName] = $myFieldValue; $aNewRow[$myFieldName] = $myFieldValue;
*/
// }
} }
// Add new row to result // Add new row to result
$aResult[] = $aNewRow; $aResult[] = $aNewRow;
} }
@ -865,7 +889,6 @@ class LogStreamDB extends LogStream {
return ERROR_NOMORERECORDS; return ERROR_NOMORERECORDS;
} }
/** /**
* Implementation of GetCountSortedByField * Implementation of GetCountSortedByField
* *
@ -939,6 +962,7 @@ class LogStreamDB extends LogStream {
} }
/* /*
* ============= Beginn of private functions ============= * ============= Beginn of private functions =============
*/ */

View File

@ -293,148 +293,191 @@ class Report_syslogsummary extends Report {
*/ */
private function ConsolidateSyslogmessagesPerHost( $arrHosts ) private function ConsolidateSyslogmessagesPerHost( $arrHosts )
{ {
global $content, $gl_starttime; global $content, $gl_starttime, $fields;
// Now open the stream for data processing // Now open the stream for data processing
$res = $this->_streamObj->Open( $this->_arrProperties, true ); $res = $this->_streamObj->Open( $this->_arrProperties, true );
if ( $res == SUCCESS ) if ( $res == SUCCESS )
{ {
// Set reading direction if ( true )
// $this->_streamObj->SetReadDirection( EnumReadDirection::Backward ); {
// --- New Method to consolidate data!
// Init uid helper
$uID = UID_UNKNOWN;
// Set position to BEGIN of FILE
$this->_streamObj->Sseek($uID, EnumSeek::BOS, 0);
// Start reading data
$ret = $this->_streamObj->Read($uID, $logArray);
// TimeStats // TimeStats
$nowtime = microtime_float(); $nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s "; $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// Found first data record foreach ( $arrHosts as $myHost )
if ( $ret == SUCCESS )
{ {
do // Set custom filters
$this->_streamObj->ResetFilters();
$this->_streamObj->SetFilter( $this->_filterString . " " . $fields[SYSLOG_MESSAGETYPE]['SearchField'] . ":=" . IUT_Syslog . " " . $fields[SYSLOG_HOST]['SearchField'] . ":=" . $myHost );
// Set Host Item Basics if not set yet
$content["report_consdata"][ $myHost ][SYSLOG_HOST] = $myHost;
// Get Data for single host
$content["report_consdata"][ $myHost ]['cons_msgs'] = $this->_streamObj->ConsolidateDataByField( MISC_CHECKSUM, $this->_maxMsgsPerHost, MISC_CHECKSUM, SORTING_ORDER_DESC, null, true, true );
//print_r ($fields[SYSLOG_MESSAGE]);
foreach ( $content["report_consdata"][ $myHost ]['cons_msgs'] as &$myConsData )
{ {
// Check if Event from host is in our hosts array // Set Basic data entries
if ( in_array($logArray[SYSLOG_HOST], $arrHosts) ) if (!isset( $content['filter_facility_list'][$myConsData[SYSLOG_FACILITY]] ))
$myConsData[SYSLOG_FACILITY] = SYSLOG_LOCAL0; // Set default in this case
if (!isset( $content['filter_severity_list'][$myConsData[SYSLOG_SEVERITY]] ))
$myConsData[SYSLOG_SEVERITY] = SYSLOG_NOTICE; // Set default in this case
// Set Counter and First/Last Event date
$myConsData['FirstOccurrence_Date'] = $myConsData[SYSLOG_DATE];
$myConsData['LastOccurrence_Date'] = $myConsData[SYSLOG_DATE];
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// ---
}
else
{
// --- Old Method!
// Init uid helper
$uID = UID_UNKNOWN;
// Set position to BEGIN of FILE
$this->_streamObj->Sseek($uID, EnumSeek::BOS, 0);
// Start reading data
$ret = $this->_streamObj->Read($uID, $logArray);
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// Found first data record
if ( $ret == SUCCESS )
{
do
{ {
// Set Host Item Basics if not set yet // Check if Event from host is in our hosts array
if ( !isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ][SYSLOG_HOST]) ) if ( in_array($logArray[SYSLOG_HOST], $arrHosts) )
{ {
$content["report_consdata"][ $logArray[SYSLOG_HOST] ][SYSLOG_HOST] = $logArray[SYSLOG_HOST]; // Set Host Item Basics if not set yet
} if ( !isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ][SYSLOG_HOST]) )
{
$content["report_consdata"][ $logArray[SYSLOG_HOST] ][SYSLOG_HOST] = $logArray[SYSLOG_HOST];
}
// Calc checksum // Calc checksum
if ( !isset($logArray[MISC_CHECKSUM]) || $logArray[MISC_CHECKSUM] == 0 ) if ( !isset($logArray[MISC_CHECKSUM]) || $logArray[MISC_CHECKSUM] == 0 )
{ {
// Calc crc32 from message, we use this as index // Calc crc32 from message, we use this as index
$logArray[MISC_CHECKSUM] = crc32( $logArray[SYSLOG_MESSAGE] ); // Maybe useful somewhere else: sprintf( "%u", crc32 ( $logArray[SYSLOG_MESSAGE] )); $logArray[MISC_CHECKSUM] = crc32( $logArray[SYSLOG_MESSAGE] ); // Maybe useful somewhere else: sprintf( "%u", crc32 ( $logArray[SYSLOG_MESSAGE] ));
$strChecksum = $logArray[MISC_CHECKSUM]; $strChecksum = $logArray[MISC_CHECKSUM];
// Save calculated Checksum into DB! // Save calculated Checksum into DB!
$this->_streamObj->SaveMessageChecksum($logArray); $this->_streamObj->SaveMessageChecksum($logArray);
} }
else // Get checksum else // Get checksum
$strChecksum = $logArray[MISC_CHECKSUM]; $strChecksum = $logArray[MISC_CHECKSUM];
// Check if entry exists in result array // Check if entry exists in result array
if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]) ) if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]) )
{ {
// Increment counter and set First/Last Event date // Increment counter and set First/Last Event date
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['ItemCount']++; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['ItemCount']++;
// Set FirstEvent date if necessary! // Set FirstEvent date if necessary!
if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] < $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'][EVTIME_TIMESTAMP] ) if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] < $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'][EVTIME_TIMESTAMP] )
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE];
// Set LastEvent date if necessary! // Set LastEvent date if necessary!
if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] > $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'][EVTIME_TIMESTAMP] ) if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] > $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'][EVTIME_TIMESTAMP] )
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE];
}
else
{
// Set Basic data entries
if (isset( $content['filter_facility_list'][$logArray[SYSLOG_FACILITY]] ))
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_FACILITY] = $logArray[SYSLOG_FACILITY];
else
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_FACILITY] = SYSLOG_LOCAL0; // Set default in this case
if (isset( $content['filter_severity_list'][$logArray[SYSLOG_SEVERITY]] ))
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_SEVERITY] = $logArray[SYSLOG_SEVERITY];
else
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_SEVERITY] = SYSLOG_NOTICE; // Set default in this case
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_SYSLOGTAG] = $logArray[SYSLOG_SYSLOGTAG];
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_MESSAGE] = $logArray[SYSLOG_MESSAGE];
// Set Counter and First/Last Event date
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['ItemCount'] = 1;
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE];
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE];
}
} }
else
{
// Set Basic data entries
if (isset( $content['filter_facility_list'][$logArray[SYSLOG_FACILITY]] ))
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_FACILITY] = $logArray[SYSLOG_FACILITY];
else
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_FACILITY] = SYSLOG_LOCAL0; // Set default in this case
if (isset( $content['filter_severity_list'][$logArray[SYSLOG_SEVERITY]] ))
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_SEVERITY] = $logArray[SYSLOG_SEVERITY];
else
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_SEVERITY] = SYSLOG_NOTICE; // Set default in this case
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_SYSLOGTAG] = $logArray[SYSLOG_SYSLOGTAG];
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_MESSAGE] = $logArray[SYSLOG_MESSAGE];
// Set Counter and First/Last Event date // Get next data record
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['ItemCount'] = 1; $ret = $this->_streamObj->ReadNext($uID, $logArray);
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE]; } while ( $ret == SUCCESS );
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE];
} // TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
}
else
return $ret;
}
// --- Start Postprocessing
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
{
// First use callback function to sort array
uasort($tmpConsolidatedComputer['cons_msgs'], "MultiSortArrayByItemCountDesc");
// Remove entries according to _maxMsgsPerHost
if ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost )
{
$iDropCount = 0;
do
{
array_pop($tmpConsolidatedComputer['cons_msgs']);
$iDropCount++;
} while ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost );
// Append a dummy entry which shows count of all other events
if ( $iDropCount > 0 )
{
$lastEntry[SYSLOG_SEVERITY] = SYSLOG_NOTICE;
$lastEntry[SYSLOG_FACILITY] = SYSLOG_LOCAL0;
$lastEntry[SYSLOG_SYSLOGTAG] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry['ItemCount'] = $iDropCount;
$lastEntry['FirstOccurrence_Date'] = "-";
$lastEntry['LastOccurrence_Date'] = "-";
$tmpConsolidatedComputer['cons_msgs'][] = $lastEntry;
} }
}
// Get next data record
$ret = $this->_streamObj->ReadNext($uID, $logArray);
} while ( $ret == SUCCESS );
// TimeStats // TimeStats
$nowtime = microtime_float(); $nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s "; $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// Start Postprocessing // PostProcess Events!
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer ) foreach( $tmpConsolidatedComputer["cons_msgs"] as &$tmpMyEvent )
{ {
// First use callback function to sort array $tmpMyEvent['FirstOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['FirstOccurrence_Date'] );
uasort($tmpConsolidatedComputer['cons_msgs'], "MultiSortArrayByItemCountDesc"); $tmpMyEvent['LastOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['LastOccurrence_Date'] );
$tmpMyEvent['syslogseverity_text'] = $this->GetSeverityDisplayName($tmpMyEvent['syslogseverity']); //$content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
// Remove entries according to _maxMsgsPerHost $tmpMyEvent['syslogfacility_text'] = $this->GetFacilityDisplayName($tmpMyEvent['syslogfacility']); //$content['filter_facility_list'][ $tmpMyEvent['syslogfacility'] ]["DisplayName"];
if ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost ) $tmpMyEvent['syslogseverity_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogseverity']);
{ $tmpMyEvent['syslogfacility_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogfacility']);
$iDropCount = 0;
do
{
array_pop($tmpConsolidatedComputer['cons_msgs']);
$iDropCount++;
} while ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost );
// Append a dummy entry which shows count of all other events
if ( $iDropCount > 0 )
{
$lastEntry[SYSLOG_SEVERITY] = SYSLOG_NOTICE;
$lastEntry[SYSLOG_FACILITY] = SYSLOG_LOCAL0;
$lastEntry[SYSLOG_SYSLOGTAG] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry['ItemCount'] = $iDropCount;
$lastEntry['FirstOccurrence_Date'] = "-";
$lastEntry['LastOccurrence_Date'] = "-";
$tmpConsolidatedComputer['cons_msgs'][] = $lastEntry;
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// PostProcess Events!
foreach( $tmpConsolidatedComputer["cons_msgs"] as &$tmpMyEvent )
{
$tmpMyEvent['FirstOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['FirstOccurrence_Date'] );
$tmpMyEvent['LastOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['LastOccurrence_Date'] );
$tmpMyEvent['syslogseverity_text'] = $this->GetSeverityDisplayName($tmpMyEvent['syslogseverity']); //$content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
$tmpMyEvent['syslogfacility_text'] = $this->GetFacilityDisplayName($tmpMyEvent['syslogfacility']); //$content['filter_facility_list'][ $tmpMyEvent['syslogfacility'] ]["DisplayName"];
$tmpMyEvent['syslogseverity_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogseverity']);
$tmpMyEvent['syslogfacility_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogfacility']);
}
} }
} }
else // ---
return $ret;
} }
// Work done! // Work done!

View File

@ -95,30 +95,29 @@
<table width="100%" cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate"> <table width="100%" cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr> <tr>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td> <td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstoccurrence}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstoccurrence}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastoccurrence}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastoccurrence}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_severity}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" align="center" width="150" nowrap>{ln_report_facility}</td> <td class="cellmenu1" align="center" width="150" nowrap>{ln_report_facility}</td>
<td class="cellmenu1" align="center" width="80" nowrap>{ln_report_syslogtag}</td> <td class="cellmenu1" align="center" width="80" nowrap>{ln_report_syslogtag}</td>
<td class="cellmenu1" align="center" width="100%" nowrap>{ln_report_description}</td> <td class="cellmenu1" align="center" width="100%" nowrap>{ln_report_description}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr> </tr>
<!-- BEGIN cons_msgs --> <!-- BEGIN cons_msgs -->
<tr> <tr>
<td class="line1" valign="top" align="center">{ZAEHLER}</td> <td class="line1" valign="top" align="center">{ZAEHLER}</td>
<td class="line1" valign="top" align="center">{FirstOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="center">{LastOccurrence_Date_Formatted}</td>
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogseverity_bgcolor}"><b>{syslogseverity_text}</b></td>
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogfacility_bgcolor}"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td>
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td>
<td class="line1" valign="top" align="left">{msg}</td>
<!-- IF ItemCount>=$_colorThreshold --> <!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#990000"><b>{ItemCount}</b></td> <td class="lineColouredWhite" valign="top" align="right" bgcolor="#990000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold --> <!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold --> <!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#AAAAAA"><b>{ItemCount}</b></td> <td class="lineColouredWhite" valign="top" align="right" bgcolor="#AAAAAA"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold --> <!-- ENDIF ItemCount<$_colorThreshold -->
<td class="line1" valign="top" align="center">{FirstOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="center">{LastOccurrence_Date_Formatted}</td>
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogseverity_bgcolor}"><b>{syslogseverity_text}</b></td>
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogfacility_bgcolor}"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td>
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td>
<td class="line1" valign="top" align="left">{msg}</td>
</tr> </tr>
<!-- END cons_msgs --> <!-- END cons_msgs -->

View File

@ -68,27 +68,27 @@
<table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate"> <table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate">
<tr> <tr>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_number}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstoccurrence}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstoccurrence}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastoccurrence}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastoccurrence}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_severity}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_facility}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_facility}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_syslogtag}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_syslogtag}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr> </tr>
<!-- BEGIN cons_msgs --> <!-- BEGIN cons_msgs -->
<tr> <tr>
<td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td> <td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td>
<td class="line1" valign="top" align="left">{FirstOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{LastOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{syslogseverity_text}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td>
<!-- IF ItemCount>=$_colorThreshold --> <!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{ItemCount}</b></td> <td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold --> <!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold --> <!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{ItemCount}</b></td> <td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold --> <!-- ENDIF ItemCount<$_colorThreshold -->
<td class="line1" valign="top" align="left">{FirstOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{LastOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{syslogseverity_text}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td>
</tr> </tr>
<tr> <tr>
<td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td> <td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td>

View File

@ -566,8 +566,8 @@ function CheckAndSetRunMode()
// Define and Inits Syslog variables now! // Define and Inits Syslog variables now!
// DEPRECIATED! define_syslog_variables(); // DEPRECIATED! define_syslog_variables();
// Syslog Constants are defined by default anyway! // Syslog Constants are defined by default anyway!
openlog("LogAnalyzer", LOG_PID, LOG_USER); $syslogOpened = openlog("LogAnalyzer", LOG_PID, LOG_USER);
// --- Check necessary PHP Extensions! // --- Check necessary PHP Extensions!
$loadedExtensions = get_loaded_extensions(); $loadedExtensions = get_loaded_extensions();
@ -1347,7 +1347,7 @@ function OutputDebugMessage($szDbg, $szDbgLevel = DEBUG_INFO)
// Check if the user wants to syslog the error! // Check if the user wants to syslog the error!
if ( GetConfigSetting("MiscDebugToSyslog", 0, CFGLEVEL_GLOBAL) == 1 ) if ( GetConfigSetting("MiscDebugToSyslog", 0, CFGLEVEL_GLOBAL) == 1 )
{ {
syslog(GetPriorityFromDebugLevel($szDbgLevel), $szDbg); $syslogSend = syslog(GetPriorityFromDebugLevel($szDbgLevel), $szDbg);
} }
} }