mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Fixed multiple minor report issues
This commit is contained in:
parent
267147e059
commit
d2eb2bb0bf
@ -665,6 +665,10 @@ class LogStreamDisk extends LogStream {
|
||||
|
||||
// We loop through all loglines! this may take a while!
|
||||
$uID = UID_UNKNOWN;
|
||||
|
||||
// Needed to reset file position!
|
||||
$this->Sseek($uID, EnumSeek::BOS, 0);
|
||||
|
||||
$ret = $this->Read($uID, $logArray);
|
||||
if ( $ret == SUCCESS )
|
||||
{
|
||||
@ -721,9 +725,6 @@ class LogStreamDisk extends LogStream {
|
||||
$aResult[ $content['LN_STATS_OTHERS'] ] = $arrEntryCopy;
|
||||
}
|
||||
|
||||
// Needed to reset file position!
|
||||
$this->Sseek($uID, EnumSeek::BOS, 0);
|
||||
|
||||
// finally return result!
|
||||
if ( count($aResult) > 0 )
|
||||
return $aResult;
|
||||
@ -751,6 +752,10 @@ class LogStreamDisk extends LogStream {
|
||||
|
||||
// We loop through all loglines! this may take a while!
|
||||
$uID = UID_UNKNOWN;
|
||||
|
||||
// Needed to reset file position!
|
||||
$this->Sseek($uID, EnumSeek::BOS, 0);
|
||||
|
||||
$ret = $this->Read($uID, $logArray);
|
||||
if ( $ret == SUCCESS )
|
||||
{
|
||||
@ -819,9 +824,6 @@ class LogStreamDisk extends LogStream {
|
||||
$aResult[ $content['LN_STATS_OTHERS'] ] = $arrEntryCopy;
|
||||
}
|
||||
|
||||
// Needed to reset file position!
|
||||
$this->Sseek($uID, EnumSeek::BOS, 0);
|
||||
|
||||
// finally return result!
|
||||
if ( count($aResult) > 0 )
|
||||
return $aResult;
|
||||
|
@ -130,7 +130,7 @@ abstract class Report {
|
||||
|
||||
// Fix Filename manually for FILE LOGSTREAM!
|
||||
if ( $content['Sources'][$this->_mySourceID]['SourceType'] == SOURCE_DISK )
|
||||
$this->_streamCfgObj->FileName = CheckAndPrependRootPath(DB_StripSlahes($content['Sources'][$this->_mySourceID]['DiskFile']));
|
||||
$this->_streamCfgObj->FileName = CheckAndPrependRootPath( $content['Sources'][$this->_mySourceID]['DiskFile'] );
|
||||
}
|
||||
else
|
||||
return ERROR_SOURCENOTFOUND;
|
||||
|
@ -233,18 +233,24 @@ class Report_monilog extends Report {
|
||||
$res = $this->_streamObj->Open( $this->_arrProperties, true );
|
||||
if ( $res == SUCCESS )
|
||||
{
|
||||
|
||||
// Set reading direction
|
||||
$this->_streamObj->SetReadDirection( EnumReadDirection::Backward );
|
||||
// $this->_streamObj->SetReadDirection( EnumReadDirection::Backward );
|
||||
|
||||
// Init uid helper
|
||||
$uID = UID_UNKNOWN;
|
||||
|
||||
// Set reading direction
|
||||
$this->_streamObj->Sseek($uID, EnumSeek::EOS, 0);
|
||||
// Set position to BEGIN of FILE
|
||||
$this->_streamObj->Sseek($uID, EnumSeek::BOS, 0);
|
||||
|
||||
// Start reading data
|
||||
$ret = $this->_streamObj->Read($uID, $logArray);
|
||||
|
||||
// TimeStats
|
||||
global $gl_starttime;
|
||||
$nowtime = microtime_float();
|
||||
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||
|
||||
// Found first data record
|
||||
if ( $ret == SUCCESS )
|
||||
{
|
||||
@ -265,6 +271,8 @@ class Report_monilog extends Report {
|
||||
// Calc crc32 from message, we use this as index
|
||||
$logArray[MISC_CHECKSUM] = crc32( $logArray[SYSLOG_MESSAGE] );
|
||||
$strChecksum = $logArray[MISC_CHECKSUM];
|
||||
|
||||
// TODO, save calculated Checksum into DB!
|
||||
}
|
||||
|
||||
// Check if entry exists in result array
|
||||
@ -295,11 +303,15 @@ class Report_monilog extends Report {
|
||||
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['LastEvent_Date'] = $logArray[SYSLOG_DATE];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get next data record
|
||||
$ret = $this->_streamObj->ReadNext($uID, $logArray);
|
||||
} while ( $ret == SUCCESS );
|
||||
|
||||
// TimeStats
|
||||
$nowtime = microtime_float();
|
||||
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||
|
||||
// Start Postprocessing
|
||||
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
|
||||
{
|
||||
@ -309,12 +321,32 @@ class Report_monilog extends Report {
|
||||
// Remove entries according to _maxEventsPerHost
|
||||
if ( count($tmpConsolidatedComputer['cons_events']) > $this->_maxEventsPerHost )
|
||||
{
|
||||
$iDropCount = 0;
|
||||
|
||||
do
|
||||
{
|
||||
array_pop($tmpConsolidatedComputer['cons_events']);
|
||||
$iDropCount++;
|
||||
} while ( count($tmpConsolidatedComputer['cons_events']) > $this->_maxEventsPerHost );
|
||||
|
||||
// Append a dummy entry which shows count of all other events
|
||||
if ( $iDropCount > 0 )
|
||||
{
|
||||
$lastEntry[SYSLOG_SEVERITY] = 5;
|
||||
$lastEntry[SYSLOG_EVENT_ID] = "-";
|
||||
$lastEntry[SYSLOG_EVENT_SOURCE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
|
||||
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
|
||||
$lastEntry['ItemCount'] = $iDropCount;
|
||||
$lastEntry['FirstEvent_Date'] = "-";
|
||||
$lastEntry['LastEvent_Date'] = "-";
|
||||
|
||||
$tmpConsolidatedComputer['cons_events'][] = $lastEntry;
|
||||
}
|
||||
}
|
||||
|
||||
// TimeStats
|
||||
$nowtime = microtime_float();
|
||||
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
|
||||
|
||||
// PostProcess Events!
|
||||
foreach( $tmpConsolidatedComputer["cons_events"] as &$tmpMyEvent )
|
||||
|
@ -122,7 +122,7 @@
|
||||
<!-- IF ShowPageRenderStats="true" -->
|
||||
<td align="center" class="line2" valign="_top">
|
||||
<small>
|
||||
{LN_FOOTER_PAGERENDERED}: <B>{report_rendertime}</B>
|
||||
{LN_REPORT_FOOTER_ENDERED}: <B>{report_rendertime}</B>
|
||||
| {LN_FOOTER_DBQUERIES}: <B>{TOTALQUERIES}</B>
|
||||
</small>
|
||||
</td>
|
||||
|
@ -66,6 +66,6 @@ define('ERROR_MSG_NOMATCH', 18);
|
||||
define('ERROR_CHARTS_NOTCONFIGURED', 20);
|
||||
define('ERROR_MSG_SKIPMESSAGE', 21);
|
||||
define('ERROR_MSG_SCANABORTED', 23);
|
||||
define('ERROR_REPORT_NODATA', 24);
|
||||
define('ERROR_REPORT_NODATA', 25);
|
||||
|
||||
?>
|
@ -339,5 +339,10 @@ $content['LN_ORACLE_WHOIS'] = "WHOIS Lookup for '%1' value '%2'";
|
||||
$content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'] = "Invalid or missing savedreport id";
|
||||
$content['LN_GEN_ERROR_REPORTGENFAILED'] = "Failed generating report '%1' with the following error reason: %2";
|
||||
$content['LN_GEN_ERROR_WHILEREPORTGEN'] = "Error occured while generating report";
|
||||
$content['LN_GEN_ERROR_REPORT_NODATA'] = "No data found for report generation";
|
||||
$content['LN_GEN_ALL_OTHER_EVENTS'] = "All other events";
|
||||
$content['LN_REPORT_FOOTER_ENDERED'] = "Report rendered in:";
|
||||
|
||||
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user