Log viewer view all of freeswitch log files (#5500)

* log viewer view all of freeswitch log files

* Update app_languages.php

* Update log_viewer.php
This commit is contained in:
agree
2020-09-29 12:12:28 -04:00
committed by GitHub
parent 7ca85632c3
commit 0560b57dcc
2 changed files with 42 additions and 12 deletions

View File

@@ -148,6 +148,26 @@ $text['label-size']['ru-ru'] = "KB";
$text['label-size']['sv-se'] = "KB";
$text['label-size']['uk-ua'] = "КБ";
$text['label-log_file']['en-us'] = "Log file";
$text['label-log_file']['ar-eg'] = "Log file";
$text['label-log_file']['de-at'] = "Log file";
$text['label-log_file']['de-ch'] = "log_file";
$text['label-log_file']['de-de'] = "log_file";
$text['label-log_file']['es-cl'] = "log_file";
$text['label-log_file']['es-mx'] = "log_file";
$text['label-log_file']['fr-ca'] = "Log file";
$text['label-log_file']['fr-fr'] = "Log file";
$text['label-log_file']['he-il'] = "Log file";
$text['label-log_file']['it-it'] = "Log file";
$text['label-log_file']['nl-nl'] = "Log file";
$text['label-log_file']['pl-pl'] = "Log file";
$text['label-log_file']['pt-br'] = "Log file";
$text['label-log_file']['pt-pt'] = "Log file";
$text['label-log_file']['ro-ro'] = "Log file";
$text['label-log_file']['ru-ru'] = "Log file";
$text['label-log_file']['sv-se'] = "Log file";
$text['label-log_file']['uk-ua'] = "Log file";
$text['label-filter']['en-us'] = "Filter";
$text['label-filter']['en-gb'] = "Filter";
$text['label-filter']['ar-eg'] = "";
@@ -274,4 +294,4 @@ $text['label-display']['ru-ru'] = "Display";
$text['label-display']['sv-se'] = "Display";
$text['label-display']['uk-ua'] = "Display";
?>
?>

View File

@@ -55,18 +55,19 @@
//set a default filter
if (!isset($_POST['filter'])) { $_POST['filter'] = ""; }
//set default default log file
if (!isset($_POST['log_file']) || substr($_POST['log_file'],0,14) != "freeswitch.log") { $_POST['log_file'] = "freeswitch.log"; }
//download the log
if (permission_exists('log_download')) {
if (isset($_GET['a']) && $_GET['a'] == "download") {
if (isset($_GET['t']) && $_GET['t'] == "logs") {
$tmp = $_SESSION['switch']['log']['dir'].'/';
$filename = 'freeswitch.log';
}
if (isset($_GET['n']) && substr($_GET['n'],0,14) == "freeswitch.log") {
$dir = $_SESSION['switch']['log']['dir'];
$filename = $_GET['n'];
session_cache_limiter('public');
$fd = fopen($tmp.$filename, "rb");
$fd = fopen($dir."/".$filename, "rb");
header("Content-Type: binary/octet-stream");
header("Content-Length: " . filesize($tmp.$filename));
header('Content-Disposition: attachment; filename="'.escape($filename).'"');
header("Content-Length: " . filesize($tmp."/".$filename));
header('Content-Disposition: attachment; filename="'.$filename.'"');
fpassthru($fd);
exit;
}
@@ -81,13 +82,20 @@
echo " <div class='heading'><b>".$text['title-log_viewer']."</b></div>\n";
echo " <div class='actions'>\n";
echo "<form name='frm' id='frm' class='inline' method='post'>\n";
echo " ".$text['label-log_file']." <select name='log_file' class='formfld' style='width: 150px; margin-right: 20px;'>";
$files = scandir($_SESSION['switch']['log']['dir']);
foreach($files as $file) if (substr($file,0,14) == "freeswitch.log") {
$selected = ($file == $_POST['log_file']) ? "selected='selected'" : "";
echo " <option value='".$file."'".$selected.">".$file."</option>";
}
echo " </select>\n";
echo $text['label-filter']." <input type='text' name='filter' class='formfld' style='width: 150px; text-align: center; margin-right: 20px;' value=\"".escape($_POST['filter'])."\" onclick='this.select();'>";
echo "<label style='margin-right: 20px; margin-top: 4px;'><input type='checkbox' name='line_number' id='line_number' value='1' ".($_POST['line_number'] == 1 ? 'checked' : null)."> ".$text['label-line_number']."</label>";
echo "<label style='margin-right: 20px; margin-top: 4px;'><input type='checkbox' name='sort' id='sort' value='desc' ".($_POST['sort'] == 'desc' ? 'checked' : null)."> ".$text['label-sort']."</label>";
echo $text['label-display']." <input type='text' class='formfld' style='width: 50px; text-align: center;' name='size' value=\"".escape($_POST['size'])."\" onclick='this.select();'> ".$text['label-size'];
echo button::create(['type'=>'submit','label'=>$text['button-update'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;','name'=>'submit']);
if (permission_exists('log_download')) {
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'style'=>'margin-left: 15px;','link'=>'log_viewer.php?a=download&t=logs']);
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'style'=>'margin-left: 15px;','link'=>'log_viewer.php?a=download&n='.$_POST['log_file']]);
}
echo "</form>\n";
echo " </div>\n";
@@ -107,7 +115,9 @@
$default_type = 'normal';
$default_font = 'monospace';
$default_file_size = '512000';
$log_file = $_SESSION['switch']['log']['dir']."/freeswitch.log";
if (substr($_POST['log_file'],0,14) == "freeswitch.log") {
$log_file = $_SESSION['switch']['log']['dir']."/".$_POST['log_file'];
}
//put the color matches here...
$array_filter[0]['pattern'] = '[NOTICE]';
@@ -286,4 +296,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>