mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 11:19:26 +02:00
Enhanced search performance in disk logstream, specially when filtering in LARGE files!
This commit is contained in:
parent
2b7d1d790b
commit
7bf38af1a4
@ -656,8 +656,8 @@ abstract class LogStream {
|
|||||||
// "+",
|
// "+",
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = preg_replace( $searchArray, $replaceArray, $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] );
|
|
||||||
// $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = str_replace( '+', ' ', $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE]);
|
// $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = str_replace( '+', ' ', $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE]);
|
||||||
|
$this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = preg_replace( $searchArray, $replaceArray, $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] );
|
||||||
// ---
|
// ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class LogStreamDisk extends LogStream {
|
|||||||
$ret = $this->ReadNextForwards($uID, $arrProperitesOut);
|
$ret = $this->ReadNextForwards($uID, $arrProperitesOut);
|
||||||
else
|
else
|
||||||
$ret = $this->ReadNextBackwards($uID, $arrProperitesOut);
|
$ret = $this->ReadNextBackwards($uID, $arrProperitesOut);
|
||||||
|
|
||||||
// Only PARSE on success!
|
// Only PARSE on success!
|
||||||
if ( $ret == SUCCESS && $bParseMessage)
|
if ( $ret == SUCCESS && $bParseMessage)
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ class LogStreamDisk extends LogStream {
|
|||||||
|
|
||||||
// Run optional Message Parsers now
|
// Run optional Message Parsers now
|
||||||
$retParser = $this->_logStreamConfigObj->ProcessMsgParsers($arrProperitesOut[SYSLOG_MESSAGE], $arrProperitesOut);
|
$retParser = $this->_logStreamConfigObj->ProcessMsgParsers($arrProperitesOut[SYSLOG_MESSAGE], $arrProperitesOut);
|
||||||
|
|
||||||
// Check if we have to skip the message!
|
// Check if we have to skip the message!
|
||||||
if ( $retParser == ERROR_MSG_SKIPMESSAGE )
|
if ( $retParser == ERROR_MSG_SKIPMESSAGE )
|
||||||
$ret = $retParser;
|
$ret = $retParser;
|
||||||
@ -523,8 +523,10 @@ class LogStreamDisk extends LogStream {
|
|||||||
*/
|
*/
|
||||||
public function GetLastPageUID()
|
public function GetLastPageUID()
|
||||||
{
|
{
|
||||||
// Obtain last UID if enough records are available!
|
// Only perform lastUID scan if there are NO filters, for performance REASONS!
|
||||||
|
if ( $this->_filters != null )
|
||||||
|
return UID_UNKNOWN;
|
||||||
|
|
||||||
// Helper variables
|
// Helper variables
|
||||||
$myuid = -1;
|
$myuid = -1;
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
|
@ -230,10 +230,6 @@ if ( isset($content['Sources'][$currentSourceID]) )
|
|||||||
// TODO Implement ORDER
|
// TODO Implement ORDER
|
||||||
$stream->SetReadDirection($content['read_direction']);
|
$stream->SetReadDirection($content['read_direction']);
|
||||||
|
|
||||||
// Read First and LAST UID's before start reading the stream!
|
|
||||||
$content['uid_last'] = $stream->GetLastPageUID();
|
|
||||||
$content['uid_first'] = $stream->GetFirstPageUID();
|
|
||||||
|
|
||||||
// Set current ID and init Counter
|
// Set current ID and init Counter
|
||||||
$uID = $content['uid_current'];
|
$uID = $content['uid_current'];
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
@ -830,9 +826,12 @@ if ( isset($content['Sources'][$currentSourceID]) )
|
|||||||
// Increment Counter
|
// Increment Counter
|
||||||
$counter++;
|
$counter++;
|
||||||
} while ($counter < $content['ViewEntriesPerPage'] && ($ret = $stream->ReadNext($uID, $logArray)) == SUCCESS);
|
} while ($counter < $content['ViewEntriesPerPage'] && ($ret = $stream->ReadNext($uID, $logArray)) == SUCCESS);
|
||||||
|
|
||||||
//print_r ( $content['syslogmessages'] );
|
//print_r ( $content['syslogmessages'] );
|
||||||
|
|
||||||
|
// Move below processing - Read First and LAST UID's before start reading the stream!
|
||||||
|
$content['uid_last'] = $stream->GetLastPageUID();
|
||||||
|
$content['uid_first'] = $stream->GetFirstPageUID();
|
||||||
|
|
||||||
if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $content['ViewEntriesPerPage'] )
|
if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $content['ViewEntriesPerPage'] )
|
||||||
{
|
{
|
||||||
// Enable Pager in any case here!
|
// Enable Pager in any case here!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user