mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 11:19:26 +02:00
Implemented record limit into chartdata generation of the disk logstream
This commit is contained in:
parent
5c8a7aba3e
commit
b974bd145c
@ -151,7 +151,7 @@ if ( !$content['error_occured'] )
|
|||||||
// $graph->title->SetColor("darkred");
|
// $graph->title->SetColor("darkred");
|
||||||
|
|
||||||
// Setup the tab title
|
// Setup the tab title
|
||||||
$graph->tabtitle->Set('Messagecount sorted by "' . $content[ $fields[$content['chart_field']]['FieldCaptionID'] ] . '"');
|
$graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_COUNTBY'], $content[ $fields[$content['chart_field']]['FieldCaptionID'] ]) );
|
||||||
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,10);
|
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,10);
|
||||||
|
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ if ( !$content['error_occured'] )
|
|||||||
|
|
||||||
|
|
||||||
// Setup the tab title
|
// Setup the tab title
|
||||||
$graph->tabtitle->Set('Messagecount sorted by "' . $content[ $fields[$content['chart_field']]['FieldCaptionID'] ] . '"');
|
$graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_COUNTBY'], $content[ $fields[$content['chart_field']]['FieldCaptionID'] ]) );
|
||||||
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,10);
|
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,10);
|
||||||
|
|
||||||
// Setup the X and Y grid
|
// Setup the X and Y grid
|
||||||
|
@ -583,11 +583,17 @@ class LogStreamDisk extends LogStream {
|
|||||||
*/
|
*/
|
||||||
public function GetCountSortedByField($szFieldId, $nFieldType, $nRecordLimit)
|
public function GetCountSortedByField($szFieldId, $nFieldType, $nRecordLimit)
|
||||||
{
|
{
|
||||||
|
global $content;
|
||||||
|
|
||||||
// We loop through all loglines! this may take a while!
|
// We loop through all loglines! this may take a while!
|
||||||
$uID = UID_UNKNOWN;
|
$uID = UID_UNKNOWN;
|
||||||
$ret = $this->ReadNext($uID, $logArray);
|
$ret = $this->ReadNext($uID, $logArray);
|
||||||
if ( $ret == SUCCESS )
|
if ( $ret == SUCCESS )
|
||||||
{
|
{
|
||||||
|
// Initialize Array variable
|
||||||
|
$aResult = array();
|
||||||
|
|
||||||
|
// Loop through messages
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( isset($logArray[$szFieldId]) )
|
if ( isset($logArray[$szFieldId]) )
|
||||||
@ -595,7 +601,20 @@ class LogStreamDisk extends LogStream {
|
|||||||
if ( isset($aResult[ $logArray[$szFieldId] ]) )
|
if ( isset($aResult[ $logArray[$szFieldId] ]) )
|
||||||
$aResult[ $logArray[$szFieldId] ]++;
|
$aResult[ $logArray[$szFieldId] ]++;
|
||||||
else
|
else
|
||||||
$aResult[ $logArray[$szFieldId] ] = 1;
|
{
|
||||||
|
// Initialize entry if we haven't exceeded the RecordLImit yet!
|
||||||
|
if ( count($aResult) < $nRecordLimit )
|
||||||
|
$aResult[ $logArray[$szFieldId] ] = 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Count record to others
|
||||||
|
if ( isset($aResult[ $content['LN_STATS_OTHERS'] ]) )
|
||||||
|
$aResult[ $content['LN_STATS_OTHERS'] ]++;
|
||||||
|
else
|
||||||
|
$aResult[ $content['LN_STATS_OTHERS'] ] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
if ( isset($aResult[ $logArray[$szFieldId] ][CHARTDATA_COUNT]) )
|
if ( isset($aResult[ $logArray[$szFieldId] ][CHARTDATA_COUNT]) )
|
||||||
$aResult[ $logArray[$szFieldId] ][CHARTDATA_COUNT]++;
|
$aResult[ $logArray[$szFieldId] ][CHARTDATA_COUNT]++;
|
||||||
@ -611,6 +630,14 @@ class LogStreamDisk extends LogStream {
|
|||||||
// Sort Array, so the highest count comes first!
|
// Sort Array, so the highest count comes first!
|
||||||
array_multisort($aResult, SORT_NUMERIC, SORT_DESC);
|
array_multisort($aResult, SORT_NUMERIC, SORT_DESC);
|
||||||
|
|
||||||
|
if ( isset($aResult[ $content['LN_STATS_OTHERS'] ]) )
|
||||||
|
{
|
||||||
|
// This will move the "Others" Element to the last position!
|
||||||
|
$arrEntryCopy = $aResult[ $content['LN_STATS_OTHERS'] ];
|
||||||
|
unset($aResult[ $content['LN_STATS_OTHERS'] ]);
|
||||||
|
$aResult[ $content['LN_STATS_OTHERS'] ] = $arrEntryCopy;
|
||||||
|
}
|
||||||
|
|
||||||
// finally return result!
|
// finally return result!
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
|
@ -280,8 +280,7 @@ $content['LN_DETAIL_BACKTOLIST'] = "Back to Listview";
|
|||||||
$content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the sources into the database, the SourceType '%1' is not supported by this phpLogCon Version.";
|
$content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the sources into the database, the SourceType '%1' is not supported by this phpLogCon Version.";
|
||||||
|
|
||||||
// Stats Site
|
// Stats Site
|
||||||
$content['LN_STATS_COUNTBYSOURCE'] = "Messagecount by Source";
|
$content['LN_STATS_COUNTBY'] = "Messagecount by '%1'";
|
||||||
$content['LN_STATS_COUNTBYSYSLOGTAG'] = "Messagecount by SyslogTag";
|
|
||||||
$content['LN_STATS_GRAPH'] = "Graph";
|
$content['LN_STATS_GRAPH'] = "Graph";
|
||||||
$content['LN_GEN_ERROR_INVALIDFIELD'] = "Invalid fieldname";
|
$content['LN_GEN_ERROR_INVALIDFIELD'] = "Invalid fieldname";
|
||||||
$content['LN_GEN_ERROR_MISSINGCHARTFIELD'] = "Missing fieldname";
|
$content['LN_GEN_ERROR_MISSINGCHARTFIELD'] = "Missing fieldname";
|
||||||
|
@ -280,8 +280,9 @@ $content['LN_CONVERT_PROCESS'] = "Conversion Progress:";
|
|||||||
$content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the sources into the database, the SourceType '%1' is not supported by this phpLogCon Version.";
|
$content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the sources into the database, the SourceType '%1' is not supported by this phpLogCon Version.";
|
||||||
|
|
||||||
// Stats Site
|
// Stats Site
|
||||||
$content['LN_STATS_COUNTBYSOURCE'] = "Messagecount by Source";
|
$content['LN_STATS_COUNTBY'] = "Messagecount by '%1'";
|
||||||
$content['LN_STATS_COUNTBYSYSLOGTAG'] = "Messagecount by SyslogTag";
|
$content['LN_STATS_OTHERS'] = "All Others";
|
||||||
|
// $content['LN_STATS_COUNTBYSYSLOGTAG'] = "Messagecount by SyslogTag";
|
||||||
$content['LN_STATS_GRAPH'] = "Graph";
|
$content['LN_STATS_GRAPH'] = "Graph";
|
||||||
$content['LN_GEN_ERROR_INVALIDFIELD'] = "Invalid fieldname";
|
$content['LN_GEN_ERROR_INVALIDFIELD'] = "Invalid fieldname";
|
||||||
$content['LN_GEN_ERROR_MISSINGCHARTFIELD'] = "Missing fieldname";
|
$content['LN_GEN_ERROR_MISSINGCHARTFIELD'] = "Missing fieldname";
|
||||||
|
@ -285,8 +285,7 @@ $content['LN_DETAIL_BACKTOLIST'] = "Voltar para a lista";
|
|||||||
$content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the sources into the database, the SourceType '%1' is not supported by this phpLogCon Version.";
|
$content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the sources into the database, the SourceType '%1' is not supported by this phpLogCon Version.";
|
||||||
|
|
||||||
// Stats Site
|
// Stats Site
|
||||||
$content['LN_STATS_COUNTBYSOURCE'] = "Messagecount by Source";
|
$content['LN_STATS_COUNTBY'] = "Messagecount by '%1'";
|
||||||
$content['LN_STATS_COUNTBYSYSLOGTAG'] = "Messagecount by SyslogTag";
|
|
||||||
$content['LN_STATS_GRAPH'] = "Graph";
|
$content['LN_STATS_GRAPH'] = "Graph";
|
||||||
$content['LN_GEN_ERROR_INVALIDFIELD'] = "Invalid fieldname";
|
$content['LN_GEN_ERROR_INVALIDFIELD'] = "Invalid fieldname";
|
||||||
$content['LN_GEN_ERROR_MISSINGCHARTFIELD'] = "Missing fieldname";
|
$content['LN_GEN_ERROR_MISSINGCHARTFIELD'] = "Missing fieldname";
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<table width="400" cellpadding="0" cellspacing="0" border="0" align="center">
|
<table width="400" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||||
<tr><td class="cellmenu1" align="center"><B>{LN_STATS_GRAPH}: {LN_STATS_COUNTBYSOURCE}</B></td></tr>
|
<tr><td class="cellmenu1" align="center"><B>{LN_STATS_GRAPH}: {LN_STATS_COUNTBYSOURCE}</B></td></tr>
|
||||||
<tr><td class="line1"><img src="{BASEPATH}chartgenerator.php?type=2&byfield=FROMHOST&width=400" width="400" height="400"></td></tr>
|
<tr><td class="line1"><img src="{BASEPATH}chartgenerator.php?type=2&byfield=FROMHOST&width=400&maxrecords=10" width="400" height="400"></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<table width="400" cellpadding="0" cellspacing="0" border="0" align="center">
|
<table width="400" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||||
<tr><td class="cellmenu1" align="center"><B>{LN_STATS_GRAPH}: {LN_STATS_COUNTBYSYSLOGTAG}</B></td></tr>
|
<tr><td class="cellmenu1" align="center"><B>{LN_STATS_GRAPH}: {LN_STATS_COUNTBYSYSLOGTAG}</B></td></tr>
|
||||||
<tr><td class="line1"><img src="{BASEPATH}chartgenerator.php?type=1&byfield=syslogtag&width=400" width="400" height="400"></td></tr>
|
<tr><td class="line1"><img src="{BASEPATH}chartgenerator.php?type=1&byfield=syslogtag&width=400&maxrecords=10" width="400" height="400"></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user