mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Enhanced Eventlog Summary Report, it used the new functions to generate the reports
This commit is contained in:
parent
ea7db9a839
commit
49aa37721d
@ -296,15 +296,50 @@ class Report_eventsummary extends Report {
|
|||||||
*/
|
*/
|
||||||
private function ConsolidateEventsPerHost( $arrHosts )
|
private function ConsolidateEventsPerHost( $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
|
// --- New Method to consolidate data!
|
||||||
// $this->_streamObj->SetReadDirection( EnumReadDirection::Backward );
|
// TimeStats
|
||||||
|
$nowtime = microtime_float();
|
||||||
|
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||||
|
|
||||||
|
// Update all Checksums first!
|
||||||
|
$this->_streamObj->UpdateAllMessageChecksum();
|
||||||
|
|
||||||
|
// TimeStats
|
||||||
|
$nowtime = microtime_float();
|
||||||
|
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||||
|
|
||||||
|
foreach ( $arrHosts as $myHost )
|
||||||
|
{
|
||||||
|
// Set custom filters
|
||||||
|
$this->_streamObj->ResetFilters();
|
||||||
|
$this->_streamObj->SetFilter( $this->_filterString . " " . $fields[SYSLOG_MESSAGETYPE]['SearchField'] . ":=" . IUT_NT_EventReport . ",=" . IUT_WEVTMONV2 . " " . $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_events'] = $this->_streamObj->ConsolidateDataByField( MISC_CHECKSUM, $this->_maxEventsPerHost, MISC_CHECKSUM, SORTING_ORDER_DESC, null, true, true );
|
||||||
|
//print_r ($fields[SYSLOG_MESSAGE]);
|
||||||
|
foreach ( $content["report_consdata"][ $myHost ]['cons_events'] as &$myConsData )
|
||||||
|
{
|
||||||
|
// Set Basic data entries
|
||||||
|
if (!isset( $content['filter_severity_list'][$myConsData[SYSLOG_SEVERITY]] ))
|
||||||
|
$myConsData[SYSLOG_SEVERITY] = SYSLOG_NOTICE; // Set default in this case
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeStats
|
||||||
|
$nowtime = microtime_float();
|
||||||
|
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||||
|
// ---
|
||||||
|
|
||||||
|
/* OLD CODE
|
||||||
// Init uid helper
|
// Init uid helper
|
||||||
$uID = UID_UNKNOWN;
|
$uID = UID_UNKNOWN;
|
||||||
|
|
||||||
@ -381,6 +416,8 @@ class Report_eventsummary extends Report {
|
|||||||
// 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
|
// Start Postprocessing
|
||||||
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
|
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
|
||||||
@ -421,19 +458,32 @@ class Report_eventsummary extends Report {
|
|||||||
// PostProcess Events!
|
// PostProcess Events!
|
||||||
foreach( $tmpConsolidatedComputer["cons_events"] as &$tmpMyEvent )
|
foreach( $tmpConsolidatedComputer["cons_events"] as &$tmpMyEvent )
|
||||||
{
|
{
|
||||||
$tmpMyEvent['FirstEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['FirstEvent_Date'] );
|
$tmpMyEvent['FirstEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['FirstOccurrence_Date'] );
|
||||||
$tmpMyEvent['LastEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['LastEvent_Date'] );
|
$tmpMyEvent['LastEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['LastOccurrence_Date'] );
|
||||||
$tmpMyEvent['syslogseverity_text'] = $content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
|
$tmpMyEvent['syslogseverity_text'] = $content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
|
||||||
|
$tmpMyEvent['syslogseverity_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogseverity']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// ---
|
||||||
else
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Work done!
|
// Work done!
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function to obtain Severity background color
|
||||||
|
*/
|
||||||
|
private function GetSeverityBGColor( $nSeverity )
|
||||||
|
{
|
||||||
|
global $severity_colors;
|
||||||
|
|
||||||
|
if ( isset( $severity_colors[$nSeverity] ) )
|
||||||
|
return $severity_colors[$nSeverity];
|
||||||
|
else
|
||||||
|
return $severity_colors[SYSLOG_INFO]; //Default
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -94,30 +94,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_firstevent}</td>
|
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstevent}</td>
|
||||||
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastevent}</td>
|
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastevent}</td>
|
||||||
<td class="cellmenu1" align="center" width="150" nowrap>{ln_report_process}</td>
|
<td class="cellmenu1" align="center" width="150" nowrap>{ln_report_process}</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="80" nowrap>{ln_report_eventid}</td>
|
<td class="cellmenu1" align="center" width="80" nowrap>{ln_report_eventid}</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_events -->
|
<!-- BEGIN cons_events -->
|
||||||
<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">{FirstEvent_Date_Formatted}</td>
|
|
||||||
<td class="line1" valign="top" align="center">{LastEvent_Date_Formatted}</td>
|
|
||||||
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td>
|
|
||||||
<td class="line1" valign="top" align="center">{syslogseverity_text}</td>
|
|
||||||
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</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">{FirstEvent_Date_Formatted}</td>
|
||||||
|
<td class="line1" valign="top" align="center">{LastEvent_Date_Formatted}</td>
|
||||||
|
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td>
|
||||||
|
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogseverity_bgcolor}"><b>{syslogseverity_text}</b></td>
|
||||||
|
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</a></td>
|
||||||
|
<td class="line1" valign="top" align="left">{msg}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- END cons_events -->
|
<!-- END cons_events -->
|
||||||
|
@ -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_firstevent}</td>
|
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstevent}</td>
|
||||||
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastevent}</td>
|
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastevent}</td>
|
||||||
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_process}</td>
|
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_process}</td>
|
||||||
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_severity}</td>
|
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_severity}</td>
|
||||||
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_eventid}</td>
|
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_eventid}</td>
|
||||||
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGIN cons_events -->
|
<!-- BEGIN cons_events -->
|
||||||
<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">{FirstEvent_Date_Formatted}</td>
|
|
||||||
<td class="line1" valign="top" align="left">{LastEvent_Date_Formatted}</td>
|
|
||||||
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></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=id&q={id}" target="_blank">{id}</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">{FirstEvent_Date_Formatted}</td>
|
||||||
|
<td class="line1" valign="top" align="left">{LastEvent_Date_Formatted}</td>
|
||||||
|
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></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=id&q={id}" target="_blank">{id}</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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user