mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Starting to implement checksum feature into report engine
This commit is contained in:
parent
17920d8762
commit
68b39abe32
@ -298,6 +298,15 @@ abstract class Report {
|
||||
return $this->_customComment;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to return the ReportVersion
|
||||
*/
|
||||
public function GetReportVersion()
|
||||
{
|
||||
// return Filebasename
|
||||
return $this->_reportVersion;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to trigger initialisation
|
||||
*/
|
||||
|
@ -87,6 +87,7 @@ class Report_monilog extends Report {
|
||||
// $this->_arrProperties[] = SYSLOG_EVENT_CATEGORY;
|
||||
// $this->_arrProperties[] = SYSLOG_EVENT_USER;
|
||||
$this->_arrProperties[] = SYSLOG_MESSAGE;
|
||||
$this->_arrProperties[] = MISC_CHECKSUM;
|
||||
|
||||
}
|
||||
|
||||
@ -98,7 +99,7 @@ class Report_monilog extends Report {
|
||||
*/
|
||||
public function startDataProcessing()
|
||||
{
|
||||
global $content, $severity_colors;
|
||||
global $content, $severity_colors, $gl_starttime;
|
||||
|
||||
// Set Filter string
|
||||
$this->_streamObj->SetFilter( $this->_filterString );
|
||||
@ -114,13 +115,20 @@ class Report_monilog extends Report {
|
||||
// Get Settings and set to global content variable
|
||||
$content["report_title"] = $this->GetCustomTitle();
|
||||
$content["report_comment"] = $this->GetCustomComment();
|
||||
$content["report_version"] = $this->GetReportVersion();
|
||||
|
||||
// --- Report logic starts here
|
||||
$content["report_rendertime"] = "";
|
||||
|
||||
|
||||
// Step 1: Gather Summaries
|
||||
// Obtain data from the logstream!
|
||||
$content["report_summary"] = $this->_streamObj->ConsolidateDataByField( SYSLOG_SEVERITY, 0, SYSLOG_SEVERITY, SORTING_ORDER_DESC, null, false );
|
||||
|
||||
// TimeStats
|
||||
$nowtime = microtime_float();
|
||||
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s, ";
|
||||
|
||||
// If data is valid, we have an array!
|
||||
if ( is_array($content["report_summary"]) && count($content["report_summary"]) > 0 )
|
||||
{
|
||||
@ -147,12 +155,21 @@ class Report_monilog extends Report {
|
||||
// Get List of hosts
|
||||
$content["report_computers"] = $this->_streamObj->ConsolidateItemListByField( SYSLOG_HOST, $this->_maxHosts, SYSLOG_HOST, SORTING_ORDER_DESC );
|
||||
|
||||
// TimeStats
|
||||
$nowtime = microtime_float();
|
||||
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s, ";
|
||||
|
||||
// Create plain hosts list for Consolidate function
|
||||
foreach ( $content["report_computers"] as $tmpComputer )
|
||||
$arrHosts[] = $tmpComputer[SYSLOG_HOST];
|
||||
|
||||
// This function will consolidate the Events based per Host!
|
||||
$this->ConsolidateEventsPerHost($arrHosts);
|
||||
|
||||
// TimeStats
|
||||
$nowtime = microtime_float();
|
||||
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||
|
||||
// ---
|
||||
}
|
||||
else
|
||||
@ -236,8 +253,13 @@ class Report_monilog extends Report {
|
||||
$content["report_consdata"][ $logArray[SYSLOG_HOST] ][SYSLOG_HOST] = $logArray[SYSLOG_HOST];
|
||||
}
|
||||
|
||||
// Calc crc32 from message, we use this as index
|
||||
$strChecksum = crc32( $logArray[SYSLOG_MESSAGE] );
|
||||
// Calc checksum
|
||||
if ( !isset($logArray[MISC_CHECKSUM]) || $logArray[MISC_CHECKSUM] == 0 )
|
||||
{
|
||||
// Calc crc32 from message, we use this as index
|
||||
$logArray[MISC_CHECKSUM] = crc32( $logArray[SYSLOG_MESSAGE] );
|
||||
$strChecksum = $logArray[MISC_CHECKSUM];
|
||||
}
|
||||
|
||||
// Check if entry exists in result array
|
||||
if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]) )
|
||||
|
@ -105,5 +105,31 @@
|
||||
|
||||
<!-- END report_consdata -->
|
||||
|
||||
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="mainfooter">
|
||||
<tr>
|
||||
<td align="center" class="line0" valign="_top">Made by <a href="http://www.adiscon.com" target="_blank">Adiscon GmbH</a> (2009)</td>
|
||||
<td align="center" class="line1" valign="_top">
|
||||
<a href="http://www.phplogcon.org" target="_blank">Report</A> Version {report_version}
|
||||
</td>
|
||||
<td align="center" class="line0" valign="_top">
|
||||
<B>Partners:</B>
|
||||
</td>
|
||||
<td align="center" class="line1" valign="_top">
|
||||
<a href="http://www.rsyslog.com" target="_blank">Rsyslog</a> |
|
||||
<a href="http://www.winsyslog.com" target="_blank">WinSyslog</a>
|
||||
</td>
|
||||
<!-- IF ShowPageRenderStats="true" -->
|
||||
<td align="center" class="line2" valign="_top">
|
||||
<small>
|
||||
{LN_FOOTER_PAGERENDERED}: <B>{report_rendertime}</B>
|
||||
| {LN_FOOTER_DBQUERIES}: <B>{TOTALQUERIES}</B>
|
||||
</small>
|
||||
</td>
|
||||
<!-- ENDIF ShowPageRenderStats="true" -->
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -69,6 +69,10 @@ define('SYSLOG_WEBLOG_STATUS', 'http_status');
|
||||
define('SYSLOG_WEBLOG_BYTESSEND', 'http_bytessend');
|
||||
define('SYSLOG_WEBLOG_REFERER', 'http_referer');
|
||||
define('SYSLOG_WEBLOG_USERAGENT', 'http_useragent');
|
||||
|
||||
// Other fields
|
||||
define('MISC_SYSTEMID', 'misc_systenid');
|
||||
define('MISC_CHECKSUM', 'misc_checksum');
|
||||
// ---
|
||||
|
||||
// Define possible FIELD Types
|
||||
@ -294,6 +298,26 @@ $fields[SYSLOG_WEBLOG_USERAGENT]['FieldAlign'] = "left";
|
||||
$fields[SYSLOG_WEBLOG_USERAGENT]['SearchField'] = SYSLOG_WEBLOG_USERAGENT;
|
||||
$fields[SYSLOG_WEBLOG_USERAGENT]['SearchOnline'] = true;
|
||||
|
||||
// Misc fields
|
||||
$fields[MISC_SYSTEMID]['FieldID'] = MISC_SYSTEMID;
|
||||
$fields[MISC_SYSTEMID]['FieldDefine'] = 'MISC_SYSTEMID';
|
||||
$fields[MISC_SYSTEMID]['FieldCaption'] = 'SystemID';
|
||||
$fields[MISC_SYSTEMID]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[MISC_SYSTEMID]['Sortable'] = false;
|
||||
$fields[MISC_SYSTEMID]['DefaultWidth'] = "50";
|
||||
$fields[MISC_SYSTEMID]['FieldAlign'] = "center";
|
||||
$fields[MISC_SYSTEMID]['SearchField'] = MISC_SYSTEMID;
|
||||
$fields[MISC_SYSTEMID]['SearchOnline'] = false;
|
||||
$fields[MISC_CHECKSUM]['FieldID'] = MISC_CHECKSUM;
|
||||
$fields[MISC_CHECKSUM]['FieldDefine'] = 'MISC_CHECKSUM';
|
||||
$fields[MISC_CHECKSUM]['FieldCaption'] = 'Checksum';
|
||||
$fields[MISC_CHECKSUM]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[MISC_CHECKSUM]['Sortable'] = false;
|
||||
$fields[MISC_CHECKSUM]['DefaultWidth'] = "50";
|
||||
$fields[MISC_CHECKSUM]['FieldAlign'] = "center";
|
||||
$fields[MISC_CHECKSUM]['SearchField'] = MISC_CHECKSUM;
|
||||
$fields[MISC_CHECKSUM]['SearchOnline'] = false;
|
||||
|
||||
// Message is the last element, this order is important for the Detail page for now!
|
||||
$fields[SYSLOG_MESSAGE]['FieldID'] = SYSLOG_MESSAGE;
|
||||
$fields[SYSLOG_MESSAGE]['FieldDefine'] = 'SYSLOG_MESSAGE';
|
||||
@ -322,6 +346,8 @@ $dbmapping['monitorware']['DBMAPPINGS'][SYSLOG_EVENT_LOGTYPE] = "EventLogType";
|
||||
$dbmapping['monitorware']['DBMAPPINGS'][SYSLOG_EVENT_SOURCE] = "EventSource";
|
||||
$dbmapping['monitorware']['DBMAPPINGS'][SYSLOG_EVENT_CATEGORY] = "EventCategory";
|
||||
$dbmapping['monitorware']['DBMAPPINGS'][SYSLOG_EVENT_USER] = "EventUser";
|
||||
$dbmapping['monitorware']['DBMAPPINGS'][MISC_SYSTEMID] = "SystemID";
|
||||
$dbmapping['monitorware']['DBMAPPINGS'][MISC_CHECKSUM] = "Checksum";
|
||||
|
||||
$dbmapping['syslogng']['ID'] = "syslogng";
|
||||
$dbmapping['syslogng']['DisplayName'] = "SyslogNG";
|
||||
|
@ -218,7 +218,6 @@ if ( !$content['error_occured'] )
|
||||
|
||||
// Output to browser
|
||||
$page -> output();
|
||||
|
||||
// ---
|
||||
}
|
||||
}
|
||||
@ -229,7 +228,6 @@ if ( !$content['error_occured'] )
|
||||
$content['error_details'] = $content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user