Added audit log. Tciket #3714.

This commit is contained in:
Daniel Maya 2016-07-05 16:53:40 +02:00
parent 740915f2f9
commit 6a5538346a
3 changed files with 18 additions and 7 deletions

View File

@ -280,13 +280,10 @@ $table->data[34][1] = html_print_input_text('limit_parameters_massive',
$table->data[35][0] = __('Include agents manually disabled');
$table->data[35][1] = __('Yes').'   '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).'  ';
$table->data[35][1] .= __('No').'   '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
/*$row = array();
$row[0] = __('Include agents');
$row[1] = __('Yes') . '   ' . html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true) . '  ';
$row[1] .= __('No') . '   ' . html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
$data['include_agents'] = $row;*/
$table->data[36][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);
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

@ -205,6 +205,8 @@ function config_update_config () {
$error_update[] = __('Identification_reminder');
if (!config_update_value ('include_agents', (bool)get_parameter('include_agents')))
$error_update[] = __('Include_agents');
if (!config_update_value ('auditdir', get_parameter('auditdir')))
$error_update[] = __('Audit log directory');
break;
case 'enterprise':
if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) {
@ -908,6 +910,10 @@ function config_process_config () {
config_update_value ('include_agents', 0);
}
if (!isset ($config["auditdir"])) {
config_update_value ('auditdir',"/var/www/html/pandora_console");
}
if (!isset ($config["log_dir"])) {
if ($is_windows)
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\log';

View File

@ -191,7 +191,15 @@ function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = true, $
break;
}
$id_audit = db_process_sql_insert('tsesion', $values);
$valor = "".$values['fecha']." - ".io_safe_output($id)." - ".io_safe_output($accion)." - ".$ip. " - ".io_safe_output($descripcion)."\n";
if(empty($config["auditdir"])){
file_put_contents($config["homedir"]."/audit.log", $valor, FILE_APPEND);
}else{
file_put_contents($config["auditdir"]."/audit.log", $valor, FILE_APPEND);
}
enterprise_include_once('include/functions_audit.php');
enterprise_hook('audit_pandora_enterprise', array($id_audit, $info));