mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Added php script timeout handling into disk logstream class
This means the disk logstream will stop reading messages if we are to close before the php script timeout.
This commit is contained in:
parent
52990a07d3
commit
36f6d93074
@ -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!
|
||||
|
@ -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);
|
||||
|
||||
?>
|
||||
|
@ -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.<br><br> 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";
|
||||
|
@ -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.<br><br> 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";
|
||||
|
@ -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.<br><br> 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";
|
||||
|
@ -364,7 +364,6 @@
|
||||
</table>
|
||||
<!-- ENDIF main_pagerenabled="true" -->
|
||||
|
||||
|
||||
<!-- IF syslogmessagesenabled="false" -->
|
||||
<br><br>
|
||||
<center>
|
||||
@ -377,5 +376,17 @@
|
||||
<br><br>
|
||||
<!-- ENDIF syslogmessagesenabled="false" -->
|
||||
|
||||
<!-- IF logstream_warning="false" -->
|
||||
<br><br>
|
||||
<center>
|
||||
<div class="table_with_border_second ErrorMsg" style="width:600px">
|
||||
<div class="PriorityWarning">{LN_WARNING_LOGSTREAMTITLE}</div>
|
||||
<p align="left">{logstream_warning_details}</p>
|
||||
</div>
|
||||
<br><br>
|
||||
</center>
|
||||
<br><br>
|
||||
<!-- ENDIF logstream_warning="false" -->
|
||||
|
||||
|
||||
<!-- INCLUDE include_footer.html -->
|
Loading…
x
Reference in New Issue
Block a user