2012-06-21 Hirofumi Kosaka <kosaka@rworks.jp>

* extensions/pandora_logs.php: show the last 500k bytes
	instead error message, if the file is too large.
	Merged from 4.0.2


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6644 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2012-06-21 09:43:26 +00:00
parent 6692e4db56
commit 9b83fe82f8
2 changed files with 21 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2012-06-21 Hirofumi Kosaka <kosaka@rworks.jp>
* extensions/pandora_logs.php: show the last 500k bytes
instead error message, if the file is too large.
Merged from 4.0.2
2012-06-21 Hirofumi Kosaka <kosaka@rworks.jp>
* extensions/net_tools.php: Use 'whereis' to get command path

View File

@ -22,12 +22,18 @@ function view_logfile ($file_name) {
echo ")</h2>";
}
else {
if (filesize ($file_name) > 512000) {
echo "<h2 class='error'>".__("File is too large (> 500KB)"). "(".$file_name;
echo ")</h2>";
$file_size = filesize($file_name);
if ($file_size > 512000) {
$data = file_get_contents ($file_name, false, NULL, $file_size - 512000);
echo "<h2>$file_name (".__("File is too large (> 500KB)").")</h2>";
echo "<textarea style='width: 98%; float:right; height: 200px; margin-bottom:20px;' name='$file_name'>";
echo "... ";
echo $data;
echo "</textarea><br><br>";
}
else {
$data = file_get_contents ($file_name);
$data = file_get_contents ($file_name);
echo "<h2>$file_name (".format_numeric(filesize ($file_name)/1024)." KB) </h2>";
echo "<textarea style='width: 98%; float:right; height: 200px; margin-bottom:20px;' name='$file_name'>";
echo $data;
@ -39,18 +45,18 @@ function view_logfile ($file_name) {
function pandoralogs_extension_main () {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" );
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
view_logfile ($config["homedir"]."/pandora_console.log");
view_logfile ("/var/log/pandora/pandora_server.log");
view_logfile ("/var/log/pandora/pandora_server.error");