diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php index d9d778f..9ab00f4 100644 --- a/src/classes/logstreamdisk.class.php +++ b/src/classes/logstreamdisk.class.php @@ -225,6 +225,8 @@ class LogStreamDisk extends LogStream { */ public function ReadNext(&$uID, &$arrProperitesOut, $bParseMessage = true) { + global $content, $gl_starttime; + do { // Read next entry first! @@ -250,7 +252,18 @@ class LogStreamDisk extends LogStream { $arrProperitesOut[SYSLOG_UID] = $uID; } - // Loop until the filter applies, or another error occurs. + // Check how long we are running. If only two seconds of execution time are left, we abort further reading! + $scriptruntime = intval(microtime_float() - $gl_starttime); + if ( $scriptruntime > ($content['MaxExecutionTime']-2) ) + { + // This may display a warning message, so the user knows we stopped reading records because of the script timeout. + $content['logstream_warning'] = "false"; + $content['logstream_warning_details'] = $content['LN_WARNING_LOGSTREAMDISK_TIMEOUT']; + + return ERROR_FILE_NOMORETIME; + } + + // Loop until the filter applies, or another error occurs, and we still have TIME! } while ( $this->ApplyFilters($ret, $arrProperitesOut) != SUCCESS && $ret == SUCCESS ); // reached here means return result! diff --git a/src/include/constants_errors.php b/src/include/constants_errors.php index b47aba6..7952356 100644 --- a/src/include/constants_errors.php +++ b/src/include/constants_errors.php @@ -46,6 +46,7 @@ define('ERROR_FILE_CANT_CLOSE', 3); define('ERROR_FILE_EOF', 4); define('ERROR_FILE_BOF', 5); define('ERROR_FILE_NOT_READABLE', 15); +define('ERROR_FILE_NOMORETIME', 22); define('ERROR_UNDEFINED', 6); define('ERROR_EOS', 7); define('ERROR_NOMORERECORDS', 8); @@ -63,6 +64,6 @@ define('ERROR_DB_DBFIELDNOTFOUND', 19); define('ERROR_MSG_NOMATCH', 18); define('ERROR_CHARTS_NOTCONFIGURED', 20); define('ERROR_MSG_SKIPMESSAGE', 21); -define('ERROR_MSG_SCANABORTED', 22); +define('ERROR_MSG_SCANABORTED', 23); ?> diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 6ea1ee3..74260ca 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -88,7 +88,13 @@ $content['LN_ERROR_NORECORDS'] = "Es wurden keine syslog-Einträge gefunden. $content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong."; $content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found."; $content['LN_GEN_MOREINFORMATION'] = "More Information"; - + $content['LN_FOOTER_PAGERENDERED'] = "Page rendered in"; + $content['LN_FOOTER_DBQUERIES'] = "DB queries"; + $content['LN_FOOTER_GZIPENABLED'] = "GZIP enabled"; + $content['LN_FOOTER_SCRIPTTIMEOUT'] = "Script Timeout"; + $content['LN_FOOTER_SECONDS'] = "seconds"; + $content['LN_WARNING_LOGSTREAMTITLE'] = "Logstream Warning"; + $content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.

If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center."; // Topmenu Entries $content['LN_MENU_SEARCH'] = "Suchen"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 7de84fb..620585f 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -89,13 +89,13 @@ $content['LN_ERROR_DB_DBFIELDNOTFOUND'] = "Database Field mapping for at least o $content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong."; $content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found."; $content['LN_GEN_MOREINFORMATION'] = "More Information"; - $content['LN_FOOTER_PAGERENDERED'] = "Page rendered in"; $content['LN_FOOTER_DBQUERIES'] = "DB queries"; $content['LN_FOOTER_GZIPENABLED'] = "GZIP enabled"; $content['LN_FOOTER_SCRIPTTIMEOUT'] = "Script Timeout"; $content['LN_FOOTER_SECONDS'] = "seconds"; - + $content['LN_WARNING_LOGSTREAMTITLE'] = "Logstream Warning"; + $content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.

If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center."; // Topmenu Entries $content['LN_MENU_SEARCH'] = "Search"; diff --git a/src/lang/pt_BR/main.php b/src/lang/pt_BR/main.php index ef87c45..4d6d853 100644 --- a/src/lang/pt_BR/main.php +++ b/src/lang/pt_BR/main.php @@ -92,7 +92,13 @@ $content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas."; $content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong."; $content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found."; $content['LN_GEN_MOREINFORMATION'] = "More Information"; - + $content['LN_FOOTER_PAGERENDERED'] = "Page rendered in"; + $content['LN_FOOTER_DBQUERIES'] = "DB queries"; + $content['LN_FOOTER_GZIPENABLED'] = "GZIP enabled"; + $content['LN_FOOTER_SCRIPTTIMEOUT'] = "Script Timeout"; + $content['LN_FOOTER_SECONDS'] = "seconds"; + $content['LN_WARNING_LOGSTREAMTITLE'] = "Logstream Warning"; + $content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.

If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center."; // Topmenu Entries $content['LN_MENU_SEARCH'] = "Search"; diff --git a/src/templates/index.html b/src/templates/index.html index 36f12d1..b2bd465 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -364,7 +364,6 @@ -

@@ -377,5 +376,17 @@

+ +

+
+
+
{LN_WARNING_LOGSTREAMTITLE}
+

{logstream_warning_details}

+
+

+
+

+ + \ No newline at end of file