Skip to content

Commit 1c74d24

Browse files
committed
Allow reading more then 4MB of data
1 parent 0db552e commit 1c74d24

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/lib/classes/monitor_tools.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,14 +677,14 @@ public function _getLogData($log, $max_lines = 100) {
677677
$log = 'Logfile path error.';
678678
} else {
679679
if (is_readable($logfile)) {
680-
$log = $this->_getOutputFromExecCommand('tail -n '.intval($max_lines).' ' . escapeshellarg($logfile));
680+
$log = $this->_getOutputFromExecCommand('tail -n '.intval($max_lines).' ' . escapeshellarg($logfile), $max_lines);
681681
} else {
682682
$log = 'Unable to read ' . $logfile;
683683
}
684684
}
685685
} else {
686686
if($journalmatch != ''){
687-
$log = $this->_getOutputFromExecCommand('journalctl -n '.intval($max_lines).' --no-pager ' . escapeshellcmd($journalmatch));
687+
$log = $this->_getOutputFromExecCommand('journalctl -n '.intval($max_lines).' --no-pager ' . escapeshellcmd($journalmatch), $max_lines);
688688
}else{
689689
$log = 'Unable to read logfile';
690690
}
@@ -694,15 +694,15 @@ public function _getLogData($log, $max_lines = 100) {
694694
return $log;
695695
}
696696

697-
private function _getOutputFromExecCommand ($command) {
697+
private function _getOutputFromExecCommand ($command, $max4k = 1000) {
698698
$log = '';
699699
$fd = popen($command, 'r');
700700
if ($fd) {
701701
$n = 0;
702702
while (!feof($fd)) {
703703
$log .= fgets($fd, 4096);
704704
$n++;
705-
if ($n > 1000)
705+
if ($n > $max4k)
706706
break;
707707
}
708708
fclose($fd);

0 commit comments

Comments
 (0)