#!/usr/bin/php -q session_start(); $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'; // add translations $_SESSION['locale'] = $argv[2]; $_SERVER['REQUEST_URI'] = ''; require_once "$docroot/webGui/include/Translations.php"; require_once "$docroot/webGui/include/ColorCoding.php"; echo "
"._('Error').""._('Warning').""._('System').""._('Array').""._('Login')."
\n"; $file = realpath("/var/log/{$argv[1]}"); if ( (substr($file,0,9) == '/var/log/') && (is_file($file)) ) { $handle = popen('/usr/bin/tail -n 40 -f '.escapeshellarg($file).' 2>&1', 'r'); while (!feof($handle)) { $line = fgets($handle); if (strpos($line,'tail_log')!==false) continue; $span = "span"; foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {$span = "span class='{$type['class']}'"; break 2;} echo "<$span>".htmlspecialchars($line).""; flush(); } pclose($handle); } ?>