From 00bbb34ad9d67a4b6e71927b593c30037be5031f Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 20 Mar 2008 17:24:43 +0100 Subject: [PATCH] - Added almost all logic to read and store the filters in the logstream class. The filters are saved as array which makes it very easy to step through them , and only consider available properties. --- src/classes/logstream.class.php | 188 +++++++++++++++++++++- src/classes/logstreamconfigdisk.class.php | 8 +- src/classes/logstreamdisk.class.php | 53 +++--- src/include/constants_errors.php | 16 +- src/include/constants_filters.php | 18 +++ src/include/functions_filters.php | 13 +- src/index.php | 166 ++++++++++--------- src/search.php | 4 +- 8 files changed, 354 insertions(+), 112 deletions(-) diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index 4bfab4d..c8f0b66 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -21,9 +21,16 @@ if ( !defined('IN_PHPLOGCON') ) } // --- +// --- Basic Includes +require_once($gl_root_path . 'classes/enums.class.php'); +require_once($gl_root_path . 'include/constants_errors.php'); +require_once($gl_root_path . 'include/constants_logstream.php'); +// --- + + abstract class LogStream { protected $_readDirection = EnumReadDirection::Forward; - protected $_filter = null; + protected $_filters = null; protected $_current_uId = -1; protected $_logStreamConfigObj = null; protected $_arrProperties = null; @@ -156,14 +163,187 @@ abstract class LogStream { * @param filter object in: filter object * @return integer Error state */ - public function SetFilter($filter) + public function SetFilter($szFilters) { - // For now copy the filter string as it is - $_filter = $filter; + // Parse Filters from string + $this->ParseFilters($szFilters); return SUCCESS; } + /** + * Helper function to parse filters into a useful filter array we can work with. + */ + private function ParseFilters($szFilters) + { + if ( isset($szFilters) && strlen($szFilters) > 0 ) + { +// $this->_filters = array(); + + $tmpEntries = explode(" ", $szFilters); + foreach($tmpEntries as $myEntry) + { + // Continue if empty filter! + if ( strlen(trim($myEntry)) <= 0 ) + continue; + + if ( strpos($myEntry, ":") !== false ) + { + // Split key and value + $tmpArray = explode(":", $myEntry, 2); + + // Continue if empty filter! + if ( strlen(trim($tmpArray[FILTER_TMP_VALUE])) == 0 ) + continue; + + // Check for multiple values! + if ( strpos($tmpArray[FILTER_TMP_VALUE], ",") ) + $tmpValues = explode(",", $tmpArray[FILTER_TMP_VALUE]); + + switch( $tmpArray[FILTER_TMP_KEY] ) + { + case "facility": + $tmpKeyName = SYSLOG_FACILITY; + $tmpFilterType = FILTER_TYPE_NUMBER; + break; + case "severity": + $tmpKeyName = SYSLOG_SEVERITY; + $tmpFilterType = FILTER_TYPE_NUMBER; + break; + case "syslogtag": + $tmpKeyName = SYSLOG_SYSLOGTAG; + $tmpFilterType = FILTER_TYPE_STRING; + break; + case "source": + $tmpKeyName = SYSLOG_HOST; + $tmpFilterType = FILTER_TYPE_STRING; + break; + case "datefrom": + $tmpKeyName = SYSLOG_DATE; + $tmpFilterType = FILTER_TYPE_DATE; + $tmpTimeMode = DATEMODE_RANGE_FROM; + break; + case "dateto": + $tmpKeyName = SYSLOG_DATE; + $tmpFilterType = FILTER_TYPE_DATE; + $tmpTimeMode = DATEMODE_RANGE_TO; + break; + case "datelastx": + $tmpKeyName = SYSLOG_DATE; + $tmpFilterType = FILTER_TYPE_DATE; + $tmpTimeMode = DATEMODE_LASTX; + break; + default: + break; + // Unknown filter + } + + // --- Set Filter! + $this->_filters[$tmpKeyName][][FILTER_TYPE] = $tmpFilterType; + $iNum = count($this->_filters[$tmpKeyName]) - 1; + + if ( isset($tmpTimeMode) ) + { + $this->_filters[$tmpKeyName][$iNum][FILTER_DATEMODE] = $tmpTimeMode; + $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = $tmpArray[FILTER_TMP_VALUE]; + } + else if ( isset($tmpValues) ) + { + foreach( $tmpValues as $szValue ) + { + // Continue if empty! + if ( strlen(trim($szValue)) == 0 ) + continue; + + $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = $szValue; + } + } + else + $this->_filters[$tmpKeyName][$iNum][FILTER_VALUE] = $tmpArray[FILTER_TMP_VALUE]; + // --- + + + // Unset unused variables + if ( isset($tmpArray) ) + unset($tmpArray); + if ( isset($tmpValues) ) + unset($tmpValues); + if ( isset($tmpTimeMode) ) + unset($tmpTimeMode); + } + else + { + // No ":", so we treat it as message filter! + $this->_filters[SYSLOG_MESSAGE][][FILTER_TYPE] = FILTER_TYPE_STRING; + $iNum = count($this->_filters[SYSLOG_MESSAGE]) - 1; + $this->_filters[SYSLOG_MESSAGE][$iNum][FILTER_VALUE] = $myEntry; + } + } + } + + // Debug print +// print_r ($this->_filters); + } + + /** + * Helper function to parse filters into a useful filter array we can work with. + */ + protected function ApplyFilters($myResults, &$arrProperitesOut) + { + // IF result was unsuccessfull, return success - nothing we can do here. + if ( $myResults >= ERROR ) + return SUCCESS; + + if ( $this->_filters != null ) + { + // Evaluation default for now is true + $bEval = true; + + // Loop through set properties + foreach( $arrProperitesOut as $propertyname => $propertyvalue ) + { + // TODO: NOT SURE IF THIS WILL WORK ON NUMBERS AND OTHER TYPES RIGHT NOW + if (array_key_exists($propertyname, $this->_filters) && strlen($propertyvalue) > 0 ) + { + // Found something to filter, so do it! + foreach( $this->_filters[$propertyname] as $myfilter ) + { + switch( $myfilter[FILTER_TYPE] ) + { + case FILTER_TYPE_STRING: + if ( stripos($propertyvalue, $myfilter[FILTER_VALUE]) === false ) + $bEval = false; + break; + case FILTER_TYPE_NUMBER: + break; + case FILTER_TYPE_DATE: + break; + default: + // TODO! + break; + } + } + + if ( !$bEval ) + { + // unmatching filter, rest property array + foreach ( $this->_arrProperties as $property ) + $arrProperitesOut[$property] = ''; + + // return error! + return ERROR_FILTER_NOT_MATCH; + } + } + } + + // Reached this point means filters did match! + return SUCCESS; + } + else // No filters at all means success! + return SUCCESS; + } + + } ?> \ No newline at end of file diff --git a/src/classes/logstreamconfigdisk.class.php b/src/classes/logstreamconfigdisk.class.php index 12354cf..023e84a 100644 --- a/src/classes/logstreamconfigdisk.class.php +++ b/src/classes/logstreamconfigdisk.class.php @@ -24,7 +24,13 @@ if ( !defined('IN_PHPLOGCON') ) class LogStreamConfigDisk extends LogStreamConfig { public $FileName = ''; - public function LogStreamFactory($o) { + public function LogStreamFactory($o) + { + // An instance is created, then include the logstreamdisk class as well! + global $gl_root_path; + require_once($gl_root_path . 'classes/logstreamdisk.class.php'); + + // return LogStreamDisk instance return new LogStreamDisk($o); } diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php index dd104b1..cb4048d 100644 --- a/src/classes/logstreamdisk.class.php +++ b/src/classes/logstreamdisk.class.php @@ -173,12 +173,20 @@ class LogStreamDisk extends LogStream { * @return integer Error state * @see ReadNext */ - public function ReadNext(&$uID, &$arrProperitesOut) { - if ($this->_readDirection == EnumReadDirection::Forward) { - return $this->ReadNextForwards($uID, $arrProperitesOut); - } - - return $this->ReadNextBackwards($uID, $arrProperitesOut); + public function ReadNext(&$uID, &$arrProperitesOut) + { + do + { + // Read next entry first! + if ($this->_readDirection == EnumReadDirection::Forward) + $ret = $this->ReadNextForwards($uID, $arrProperitesOut); + else + $ret = $this->ReadNextBackwards($uID, $arrProperitesOut); + // Loop until the filter applies, or another error occurs. + } while ( $this->ApplyFilters($ret, $arrProperitesOut) != SUCCESS && $ret == SUCCESS ); + + // reached here means return result! + return $ret; } private function ReadNextForwards(&$uID, &$arrProperitesOut) { @@ -194,8 +202,12 @@ class LogStreamDisk extends LogStream { if (($this->_p_buffer == $this->_buffer_length || $this->_p_buffer == -1) && ($this->ReadNextBlock() != SUCCESS)) { return ERROR_UNDEFINED; } - + + // Init variables dynamically $line = ''; + foreach ( $this->_arrProperties as $property ) + $arrProperitesOut[$property] = ''; +/* $arrProperitesOut[SYSLOG_DATE] = ''; $arrProperitesOut[SYSLOG_FACILITY] = ''; $arrProperitesOut[SYSLOG_FACILITY_TEXT] = ''; @@ -205,7 +217,7 @@ class LogStreamDisk extends LogStream { $arrProperitesOut[SYSLOG_SYSLOGTAG] = ''; $arrProperitesOut[SYSLOG_MESSAGE] = ''; $arrProperitesOut[SYSLOG_MESSAGETYPE] = ''; - +*/ do { $pos = -1; if (($pos = strpos($this->_buffer, "\n", $this->_p_buffer)) !== false) { @@ -236,16 +248,6 @@ class LogStreamDisk extends LogStream { } private function ReadNextBackwards(&$uID, &$arrProperitesOut) { - $arrProperitesOut[SYSLOG_DATE] = ''; - $arrProperitesOut[SYSLOG_FACILITY] = ''; - $arrProperitesOut[SYSLOG_FACILITY_TEXT] = ''; - $arrProperitesOut[SYSLOG_SEVERITY] = ''; - $arrProperitesOut[SYSLOG_SEVERITY_TEXT] = ''; - $arrProperitesOut[SYSLOG_HOST] = ''; - $arrProperitesOut[SYSLOG_SYSLOGTAG] = ''; - $arrProperitesOut[SYSLOG_MESSAGE] = ''; - $arrProperitesOut[SYSLOG_MESSAGETYPE] = ''; - if ($this->_bEOS) { return ERROR_EOS; } @@ -259,7 +261,22 @@ class LogStreamDisk extends LogStream { } } + // Init variables dynamically $line = ''; + foreach ( $this->_arrProperties as $property ) + $arrProperitesOut[$property] = ''; +/* + $arrProperitesOut[SYSLOG_DATE] = ''; + $arrProperitesOut[SYSLOG_FACILITY] = ''; + $arrProperitesOut[SYSLOG_FACILITY_TEXT] = ''; + $arrProperitesOut[SYSLOG_SEVERITY] = ''; + $arrProperitesOut[SYSLOG_SEVERITY_TEXT] = ''; + $arrProperitesOut[SYSLOG_HOST] = ''; + $arrProperitesOut[SYSLOG_SYSLOGTAG] = ''; + $arrProperitesOut[SYSLOG_MESSAGE] = ''; + $arrProperitesOut[SYSLOG_MESSAGETYPE] = ''; +*/ + do { $pos = -1; $neg_offset = ($this->_buffer_length - $this->_p_buffer) * -1; diff --git a/src/include/constants_errors.php b/src/include/constants_errors.php index 17cff98..3f2357b 100644 --- a/src/include/constants_errors.php +++ b/src/include/constants_errors.php @@ -23,11 +23,13 @@ if ( !defined('IN_PHPLOGCON') ) // --- define('SUCCESS', 0); -define('ERROR_FILE_NOT_FOUND', 1); -define('ERROR_FILE_CANT_CLOSE', 2); -define('ERROR_FILE_EOF', 3); -define('ERROR_FILE_BOF', 4); -define('ERROR_UNDEFINED', 5); -define('ERROR_EOS', 6); -define('ERROR_NOMORERECORDS',7); +define('ERROR', 1); // This is a simple helper constant! which we can use to check if there even was an error! Any result code above 0 is an error! +define('ERROR_FILE_NOT_FOUND', 2); +define('ERROR_FILE_CANT_CLOSE', 3); +define('ERROR_FILE_EOF', 4); +define('ERROR_FILE_BOF', 5); +define('ERROR_UNDEFINED', 6); +define('ERROR_EOS', 7); +define('ERROR_NOMORERECORDS', 8); +define('ERROR_FILTER_NOT_MATCH', 9); ?> \ No newline at end of file diff --git a/src/include/constants_filters.php b/src/include/constants_filters.php index 28319ab..0841c5e 100644 --- a/src/include/constants_filters.php +++ b/src/include/constants_filters.php @@ -27,10 +27,28 @@ define('DATEMODE_ALL', 1); define('DATEMODE_RANGE', 2); define('DATEMODE_LASTX', 3); +define('DATEMODE_RANGE_FROM', 4); +define('DATEMODE_RANGE_TO', 5); + define('DATE_LASTX_HOUR', 1); define('DATE_LASTX_12HOURS', 2); define('DATE_LASTX_24HOURS', 3); define('DATE_LASTX_7DAYS', 4); define('DATE_LASTX_31DAYS', 5); // --- + + +// Helper constants needed for parsing filters +define('FILTER_TMP_KEY', 0); +define('FILTER_TMP_VALUE', 1); +define('FILTER_DATEMODE', 'datemode'); +define('FILTER_TYPE', 'filtertype'); +define('FILTER_DATEMODENAME', 'datemodename'); +define('FILTER_VALUE', 'value'); + +// Defines which kind of filters we have +define('FILTER_TYPE_STRING', 0); +define('FILTER_TYPE_NUMBER', 1); +define('FILTER_TYPE_DATE', 2); + ?> \ No newline at end of file diff --git a/src/include/functions_filters.php b/src/include/functions_filters.php index 412c937..f27bd57 100644 --- a/src/include/functions_filters.php +++ b/src/include/functions_filters.php @@ -49,7 +49,12 @@ function InitFilterHelpers() $currentDay = date("d", $currentTime); $currentMonth = date("m", $currentTime); $currentYear = date("Y", $currentTime); - + + $tomorrowTime = time() + 86400; // Add one day! + $tomorrowDay = date("d", $tomorrowTime); + $tomorrowMonth = date("m", $tomorrowTime); + $tomorrowYear = date("Y", $tomorrowTime); + // Init Year, month and day array! for ( $i = $currentYear-5; $i <= $currentYear+5; $i++ ) $content['years'][] = $i; @@ -83,21 +88,21 @@ function InitFilterHelpers() if ( isset($_SESSION['filter_daterange_to_year']) ) $filters['filter_daterange_to_year'] = intval($_SESSION['filter_daterange_to_year']); else - $filters['filter_daterange_to_year'] = $currentYear; + $filters['filter_daterange_to_year'] = $tomorrowYear; FillDateRangeArray($content['years'], "filter_daterange_to_year_list", "filter_daterange_to_year"); // Init filter_daterange_to_month if ( isset($_SESSION['filter_daterange_to_month']) ) $filters['filter_daterange_to_month'] = intval($_SESSION['filter_daterange_to_month']); else - $filters['filter_daterange_to_month'] = $currentMonth; + $filters['filter_daterange_to_month'] = $tomorrowMonth; FillDateRangeArray($content['months'], "filter_daterange_to_month_list", "filter_daterange_to_month"); // Init filter_daterange_to_day if ( isset($_SESSION['filter_daterange_to_day']) ) $filters['filter_daterange_to_day'] = intval($_SESSION['filter_daterange_to_day']); else - $filters['filter_daterange_to_day'] = $currentDay; + $filters['filter_daterange_to_day'] = $tomorrowDay; FillDateRangeArray($content['days'], "filter_daterange_to_day_list", "filter_daterange_to_day"); // --- Define LASTX Array diff --git a/src/index.php b/src/index.php index dcb7898..bf08272 100644 --- a/src/index.php +++ b/src/index.php @@ -21,6 +21,9 @@ include($gl_root_path . 'include/functions_common.php'); include($gl_root_path . 'include/functions_frontendhelpers.php'); include($gl_root_path . 'include/functions_filters.php'); +// Include LogStream facility +include($gl_root_path . 'classes/logstream.class.php'); + InitPhpLogCon(); InitSourceConfigs(); InitFrontEndDefaults(); // Only in WebFrontEnd @@ -51,105 +54,116 @@ $content['sorting'] = ""; $content['searchstr'] = ""; //if ( isset($content['myserver']) ) -// $content['TITLE'] = "PhpLogCon :: Home :: Server '" . $content['myserver']['Name'] . "'"; // Title of the Page +// $content['TITLE'] = "phpLogCon :: Home :: Server '" . $content['myserver']['Name'] . "'"; // Title of the Page //else - $content['TITLE'] = "PhpLogCon :: Home"; + $content['TITLE'] = "phpLogCon :: Home"; // Read and process filters from search dialog! -if ( isset($_POST['search']) && $_POST['search'] == $content['LN_SEARCH_PERFORMADVANCED']) +if ( isset($_POST['search']) ) { - if ( isset($_POST['filter_datemode']) ) + if ( $_POST['search'] == $content['LN_SEARCH_PERFORMADVANCED']) { - $filters['filter_datemode'] = intval($_POST['filter_datemode']); - if ( $filters['filter_datemode'] == DATEMODE_RANGE ) + if ( isset($_POST['filter_datemode']) ) { - // Read range values - if ( isset($_POST['filter_daterange_from_year']) ) - $filters['filter_daterange_from_year'] = intval($_POST['filter_daterange_from_year']); - if ( isset($_POST['filter_daterange_from_month']) ) - $filters['filter_daterange_from_month'] = intval($_POST['filter_daterange_from_month']); - if ( isset($_POST['filter_daterange_from_day']) ) - $filters['filter_daterange_from_day'] = intval($_POST['filter_daterange_from_day']); - if ( isset($_POST['filter_daterange_to_year']) ) - $filters['filter_daterange_to_year'] = intval($_POST['filter_daterange_to_year']); - if ( isset($_POST['filter_daterange_to_month']) ) - $filters['filter_daterange_to_month'] = intval($_POST['filter_daterange_to_month']); - if ( isset($_POST['filter_daterange_to_day']) ) - $filters['filter_daterange_to_day'] = intval($_POST['filter_daterange_to_day']); - - // Append to searchstring - $content['searchstr'] .= "datefrom:" . $filters['filter_daterange_from_year'] . "-" . - $filters['filter_daterange_from_month'] . "-" . - $filters['filter_daterange_from_day'] . "T00:00:00 "; - $content['searchstr'] .= "dateto:" . $filters['filter_daterange_to_year'] . "-" . - $filters['filter_daterange_to_month'] . "-" . - $filters['filter_daterange_to_day'] . "T00:00:00 "; - - } - else if ( $filters['filter_datemode'] == DATEMODE_LASTX ) - { - if ( isset($_POST['filter_daterange_last_x']) ) + $filters['filter_datemode'] = intval($_POST['filter_datemode']); + if ( $filters['filter_datemode'] == DATEMODE_RANGE ) { - $filters['filter_daterange_last_x'] = intval($_POST['filter_daterange_last_x']); - $content['searchstr'] .= "datefrom:" . $filters['filter_daterange_last_x'] . " "; + // Read range values + if ( isset($_POST['filter_daterange_from_year']) ) + $filters['filter_daterange_from_year'] = intval($_POST['filter_daterange_from_year']); + if ( isset($_POST['filter_daterange_from_month']) ) + $filters['filter_daterange_from_month'] = intval($_POST['filter_daterange_from_month']); + if ( isset($_POST['filter_daterange_from_day']) ) + $filters['filter_daterange_from_day'] = intval($_POST['filter_daterange_from_day']); + if ( isset($_POST['filter_daterange_to_year']) ) + $filters['filter_daterange_to_year'] = intval($_POST['filter_daterange_to_year']); + if ( isset($_POST['filter_daterange_to_month']) ) + $filters['filter_daterange_to_month'] = intval($_POST['filter_daterange_to_month']); + if ( isset($_POST['filter_daterange_to_day']) ) + $filters['filter_daterange_to_day'] = intval($_POST['filter_daterange_to_day']); + + // Append to searchstring + $content['searchstr'] .= "datefrom:" . $filters['filter_daterange_from_year'] . "-" . + $filters['filter_daterange_from_month'] . "-" . + $filters['filter_daterange_from_day'] . "T00:00:00 "; + $content['searchstr'] .= "dateto:" . $filters['filter_daterange_to_year'] . "-" . + $filters['filter_daterange_to_month'] . "-" . + $filters['filter_daterange_to_day'] . "T00:00:00 "; + + } + else if ( $filters['filter_datemode'] == DATEMODE_LASTX ) + { + if ( isset($_POST['filter_daterange_last_x']) ) + { + $filters['filter_daterange_last_x'] = intval($_POST['filter_daterange_last_x']); + $content['searchstr'] .= "datefrom:" . $filters['filter_daterange_last_x'] . " "; + } } } - } - if ( isset($_POST['filter_facility']) && count($_POST['filter_facility']) < 18 ) // If we have more than 18 elements, this means all facilities are enabled - { - $tmpStr = ""; - foreach ($_POST['filter_facility'] as $tmpfacility) + if ( isset($_POST['filter_facility']) && count($_POST['filter_facility']) < 18 ) // If we have more than 18 elements, this means all facilities are enabled { - if ( strlen($tmpStr) > 0 ) - $tmpStr .= ","; - $tmpStr .= $tmpfacility; + $tmpStr = ""; + foreach ($_POST['filter_facility'] as $tmpfacility) + { + if ( strlen($tmpStr) > 0 ) + $tmpStr .= ","; + $tmpStr .= $tmpfacility; + } + $content['searchstr'] .= "facility:" . $tmpStr . " "; } - $content['searchstr'] .= "facility:" . $tmpStr . " "; - } - if ( isset($_POST['filter_severity']) && count($_POST['filter_severity']) < 7 ) // If we have more than 7 elements, this means all facilities are enabled) - { - $tmpStr = ""; - foreach ($_POST['filter_severity'] as $tmpfacility) + if ( isset($_POST['filter_severity']) && count($_POST['filter_severity']) < 7 ) // If we have more than 7 elements, this means all facilities are enabled) { - if ( strlen($tmpStr) > 0 ) - $tmpStr .= ","; - $tmpStr .= $tmpfacility; + $tmpStr = ""; + foreach ($_POST['filter_severity'] as $tmpfacility) + { + if ( strlen($tmpStr) > 0 ) + $tmpStr .= ","; + $tmpStr .= $tmpfacility; + } + $content['searchstr'] .= "severity:" . $tmpStr . " "; } - $content['searchstr'] .= "severity:" . $tmpStr . " "; - } - // Spaces need to be converted! - if ( isset($_POST['filter_syslogtag']) && strlen($_POST['filter_syslogtag']) > 0 ) - { - $content['searchstr'] .= "syslogtag:" . $_POST['filter_syslogtag'] . " "; - } - - // Spaces need to be converted! - if ( isset($_POST['filter_source']) && strlen($_POST['filter_source']) > 0 ) - { - $content['searchstr'] .= "source:" . $_POST['filter_source'] . " "; - } - - // Message is just appended - if ( isset($_POST['filter_message']) && strlen($_POST['filter_message']) > 0 ) - $content['searchstr'] .= $_POST['filter_message']; + // Spaces need to be converted! + if ( isset($_POST['filter_syslogtag']) && strlen($_POST['filter_syslogtag']) > 0 ) + { + if ( strpos($_POST['filter_syslogtag'], " ") === false) + $content['searchstr'] .= "syslogtag:" . $_POST['filter_syslogtag'] . " "; + else + $content['searchstr'] .= "syslogtag:" . str_replace(" ", ",", $_POST['filter_syslogtag']) . " "; + } + + // Spaces need to be converted! + if ( isset($_POST['filter_source']) && strlen($_POST['filter_source']) > 0 ) + { + if ( strpos($_POST['filter_source'], " ") === false) + $content['searchstr'] .= "source:" . $_POST['filter_source'] . " "; + else + $content['searchstr'] .= "source:" . str_replace(" ", ",", $_POST['filter_source']) . " "; + } + + // Message is just appended + if ( isset($_POST['filter_message']) && strlen($_POST['filter_message']) > 0 ) + $content['searchstr'] .= $_POST['filter_message']; + } + else if ( $_POST['search'] == $content['LN_SEARCH']) + { + // Message is just appended + if ( isset($_POST['filter']) && strlen($_POST['filter']) > 0 ) + $content['searchstr'] = $_POST['filter']; + } } + + // --- // --- BEGIN Custom Code if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$currentSourceID]['SourceType'] == SOURCE_DISK ) { - require_once($gl_root_path . 'classes/enums.class.php'); - require_once($gl_root_path . 'classes/logstream.class.php'); - require_once($gl_root_path . 'classes/logstreamdisk.class.php'); - require_once($gl_root_path . 'include/constants_errors.php'); - require_once($gl_root_path . 'include/constants_logstream.php'); - - // Obtain Config Object + // Obtain and get the Config Object $stream_config = $content['Sources'][$currentSourceID]['ObjRef']; // Create LogStream Object @@ -165,7 +179,7 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren { // Copy Obtained array $content['syslogmessages'][] = $logArray; - + // Copy UID $content['syslogmessages'][$counter]['UID'] = $uID; diff --git a/src/search.php b/src/search.php index f6e29c9..ec64834 100644 --- a/src/search.php +++ b/src/search.php @@ -40,9 +40,9 @@ $content['EXTRA_JAVASCRIPT'] = "