Merge branch '656-changes-in-system-log-viewer-dev' into 'develop'

Added changes

See merge request !518
This commit is contained in:
vgilc 2017-06-14 11:32:44 +02:00
commit 7bfd3254a7
4 changed files with 27 additions and 15 deletions

View File

@ -39,10 +39,9 @@ function view_logfile ($file_name) {
echo "<h2>$file_name (" . __("File is too large than PHP memory allocated in the system.") . ")</h2>";
echo "<h2>" . __("The preview file is imposible.") . "</h2>";
}
else 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>";
else if ($file_size > ($config['max_log_size'] * 1000)) {
$data = file_get_contents ($file_name, false, NULL, $file_size - ($config['max_log_size'] * 1000));
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 "... ";
echo $data;
@ -68,10 +67,11 @@ function pandoralogs_extension_main () {
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>";
echo "<p>" . __('You can control the size information to show in general setup (Log size limit in view extension), actually ') . $config['max_log_size'] * 1000 . "B" . "</p>";
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";

View File

@ -188,6 +188,10 @@ $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Direc
$table->data[32][1] = html_print_input_text ('server_log_dir',
$config["server_log_dir"], '', 50, 255, true);
$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Maximun size to show in system log extension."), true);
$table->data[33][1] = html_print_input_text ('max_log_size',
$config["max_log_size"], '', 10, 255, true) . html_print_label(" x1000", "max_log_size", true);
$modes_tutorial = array(
'full' => __('Full mode'),
'on_demand' => __('On demand'),
@ -200,23 +204,23 @@ $table->data['tutorial_mode'][1] =
$config["tutorial_mode"], '', '', 0, true);
$config["past_planned_downtimes"] = isset($config["past_planned_downtimes"]) ? $config["past_planned_downtimes"] : 1;
$table->data[33][0] = __('Allow create planned downtimes in the past') .
$table->data[34][0] = __('Allow create planned downtimes in the past') .
ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
$table->data[33][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'&nbsp;&nbsp;';
$table->data[33][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
$table->data[34][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'&nbsp;&nbsp;';
$table->data[34][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
$table->data[34][0] = __('Limit parameters massive') .
$table->data[35][0] = __('Limit parameters massive') .
ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true);
$table->data[34][1] = html_print_input_text('limit_parameters_massive',
$table->data[35][1] = html_print_input_text('limit_parameters_massive',
$config['limit_parameters_massive'], '', 10, 10, true);
$table->data[35][0] = __('Include agents manually disabled');
$table->data[35][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).'&nbsp;&nbsp;';
$table->data[35][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
$table->data[36][0] = __('Include agents manually disabled');
$table->data[36][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).'&nbsp;&nbsp;';
$table->data[36][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
$table->data[36][0] = __('audit log directory') .
$table->data[37][0] = __('audit log directory') .
ui_print_help_tip (__("Directory where audit log is stored."), true);
$table->data[36][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
$table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';

View File

@ -194,6 +194,8 @@ function config_update_config () {
$error_update[] = __('Command Snapshot');
if (!config_update_value ('server_log_dir', get_parameter('server_log_dir')))
$error_update[] = __('Server logs directory');
if (!config_update_value ('max_log_size', get_parameter('max_log_size')))
$error_update[] = __('Log size limit in system logs viewer extension');
if (!config_update_value ('tutorial_mode', get_parameter('tutorial_mode')))
$error_update[] = __('Tutorial mode');
if (!config_update_value ('past_planned_downtimes', get_parameter('past_planned_downtimes')))
@ -1597,6 +1599,10 @@ function config_process_config () {
if (!isset($config['server_log_dir'])) {
config_update_value ('server_log_dir', "");
}
if (!isset($config['max_log_size'])) {
config_update_value ('max_log_size', 512);
}
if (!isset($config['show_group_name'])) {
config_update_value ('show_group_name', 0);

View File

@ -1085,6 +1085,8 @@ sub pandora_start_log ($){
# Dump all errors to errorlog
open (STDERR, ">> " . $pa_config->{'errorlog_file'}) or die " [ERROR] Pandora FMS can't write to Errorlog. Aborting : \n $! \n";
my $mode = 0664;
chmod $mode, $pa_config->{'errorlog_file'};
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $pa_config->{'servername'} . " Starting Pandora FMS Server. Error logging activated.\n";
}