Fixed json in audit log

This commit is contained in:
danielmaya 2018-04-05 16:57:26 +02:00
parent 19eef35614
commit e4f24b2452
17 changed files with 99 additions and 122 deletions

View File

@ -168,9 +168,8 @@ if ($create_action) {
$result = alerts_create_alert_action ($name, $id_alert_command,
$values);
$info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command .
$info_fields . ' Group: ' . $values['id_group'] .
' Action threshold: ' . $values['action_threshold'];
$info = '{"Name":"'.$name.'", "ID alert Command":"'.$id_alert_command.'", "Field information":"'.$info_fields.'", "Group":"'.$values['id_group'].'",
"Action threshold":"'.$values['action_threshold'].'"}';
}
if ($result) {
@ -245,10 +244,6 @@ if ($update_action) {
}
else {
$result = alerts_update_alert_action ($id, $values);
$info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command .
$info_fields . ' Group: ' . $group .
' Action threshold: ' . $action_threshold;
}
if ($result) {

View File

@ -294,7 +294,7 @@ if ($create_command) {
$result = alerts_create_alert_command ($name, $command,
$values);
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description. ' ' .$info_fields;
$info = '{"Name":"'.$name.'","Command":"'.$command.'","Description":"'.$description. ' '.$info_fields.'"}';
}
else {
$result = '';

View File

@ -133,7 +133,7 @@ if ($create_special_day) {
}
else {
$result = alerts_create_alert_special_day ($date, $same_day, $values);
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $values['description'];
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}';
}
}
@ -186,12 +186,12 @@ if ($update_special_day) {
}
else {
$result = alerts_update_alert_special_day ($id, $values);
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description;
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}
else {
$result = alerts_update_alert_special_day ($id, $values);
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description;
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}

View File

@ -79,7 +79,7 @@ if ($update_command) {
}
else {
$result = alerts_update_alert_command ($id, $values);
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description. ' ' .$info_fields;
$info = '{"Name":"'.$name.'","Command":"'.$command.'","Description":"'.$description. ' '.$info_fields.'"}';
}
if ($result) {

View File

@ -418,13 +418,11 @@ if ($create_template) {
$result = '';
}
if ($result) {
//db_pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values));
db_pandora_audit("Template alert management",
"Create alert template #" . $result, false, false,
json_encode($values));
}
else {
//db_pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values));
db_pandora_audit("Template alert management",
"Fail try to create alert template", false, false,
json_encode($values));

View File

@ -104,11 +104,12 @@ if ($add) {
$results = false;
}
}
db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, 'Agents: ' .
json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) .
' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Actions: ' . implode(',',$actions));
$info = array('Agents' => implode(',',$id_agents),
'Alerts' => addslashes(io_json_mb_encode($agent_alerts)),
'Fires Min' => $fires_min,
'Fires_max' => $fires_max,
'Actions' => implode(',',$actions));
db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, json_encode($info));
ui_print_result_message ($results, __('Successfully added'), __('Could not be added'));
}
}

View File

@ -43,15 +43,18 @@ $do_operation = (bool) get_parameter ('do_operation');
if ($do_operation) {
$result = agents_process_manage_config($source_id_agent,
$destiny_id_agents);
$info = array('Source agent' => $source_id_agent,
'Destinity agent' => implode(",",$destiny_id_agents));
if ($result) {
db_pandora_audit("Massive management", "Copy modules", false,
false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
false, json_encode($info));
}
else {
db_pandora_audit("Massive management",
"Fail to try copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
"Fail to try copy modules", false, false,json_encode($info));
}
}

View File

@ -98,16 +98,15 @@ if ($delete) {
}
}
}
$info = array('Agents' => implode(',',$id_agents),
'Alert templates' => implode(",",$id_alert_templates),
'Actions' => implode(',',$actions));
if ($results) {
db_pandora_audit("Massive management", "Delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Actions: ' . implode(',',$actions));
db_pandora_audit("Massive management", "Delete alert action", false, false,json_encode($info));
}
else {
db_pandora_audit("Massive management", "Fail try to delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Actions: ' . implode(',',$actions));
db_pandora_audit("Massive management", "Fail try to delete alert action", false, false, json_encode($info));
}
ui_print_result_message ($results,

View File

@ -76,13 +76,12 @@ $delete = (bool) get_parameter_post ('delete');
if ($delete) {
$result = process_manage_delete ($id_agents);
$info = '{"Agent":"'.implode(",",$id_agents).'"}';
if ($result) {
db_pandora_audit("Massive management", "Delete agent ", false, false,
'Agent: ' . json_encode($id_agents));
db_pandora_audit("Massive management", "Delete agent ", false, false,$info);
}
else {
db_pandora_audit("Massive management", "Fail try to delete agent", false, false,
'Agent: ' . json_encode($id_agents));
db_pandora_audit("Massive management", "Fail try to delete agent", false, false,$info);
}
}

View File

@ -170,13 +170,14 @@ $delete = (bool) get_parameter_post ('delete');
if ($delete) {
$result = process_manage_delete ($id_alert_template, $id_agents, $module_names);
$info = array('Agent' => implode(",",$id_agents),
'Template' => $id_alert_template, 'Module' => implode(",",$module_names));
if ($result) {
db_pandora_audit("Massive management", "Delete alert ", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
db_pandora_audit("Massive management", "Delete alert ", false, false,json_encode($info));
}
else {
db_pandora_audit("Massive management", "Fail try to delete alert", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
db_pandora_audit("Massive management", "Fail try to delete alert", false, false,json_encode($info));
}
}

View File

@ -349,13 +349,12 @@ if ($delete) {
$result = process_manage_delete ($modules_, $agents_, $modules_selection_mode);
}
$info = array('Agent' => implode(",",$agents_), 'Module' => implode(",",$modules_));
if ($result) {
db_pandora_audit("Massive management", "Delete module ", false, false,
'Agent: ' . json_encode($agents_) . ' Module: ' . $module_name);
db_pandora_audit("Massive management", "Delete module ", false, false, json_encode($info));
}
else {
db_pandora_audit("Massive management", "Fail try to delete module", false, false,
'Agent: ' . json_encode($agents_) . ' Module: ' . $module_name);
db_pandora_audit("Massive management", "Fail try to delete module", false, false, json_encode($info));
}
}

View File

@ -74,13 +74,12 @@ if ($delete_profiles) {
}
}
$info = array('Profiles' => implode(",",$profiles_id), 'Groups' => implode(",",$groups_id), 'Users' => implode(",",$users_id));
if ($result) {
db_pandora_audit("Massive management", "Delete profile ", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
db_pandora_audit("Massive management", "Delete profile ", false, false, json_encode($info));
}
else {
db_pandora_audit("Massive management", "Fail try to delete profile", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
db_pandora_audit("Massive management", "Fail try to delete profile", false, false, json_encode($info));
}
ui_print_result_message ($result,

View File

@ -197,14 +197,18 @@ if ($update_agents) {
}
}
$info = array();
// Update Custom Fields
foreach ($fields as $field) {
$info[$field['id_field']] = $field['name'];
if (get_parameter_post ('customvalue_' . $field['id_field'], '') != '') {
$key = $field['id_field'];
$value = get_parameter_post ('customvalue_' . $field['id_field'], '');
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key));
if ($old_value === false) {
// Create custom field if not exist
$result = db_process_sql_insert ('tagent_custom_data',
@ -225,11 +229,11 @@ if ($update_agents) {
if ($result !== false) {
db_pandora_audit("Massive management", "Update agent " . $id_agent, false, false, json_encode($fields));
db_pandora_audit("Massive management", "Update agent " . $id_agent, false, false, json_encode($info));
}
else {
if (isset ($id_agent)) {
db_pandora_audit("Massive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
db_pandora_audit("Massive management", "Try to update agent " . $id_agent, false, false, json_encode($info));
}
}

View File

@ -162,7 +162,7 @@ if ($update) {
__('Successfully updated') . "(" . $success . "/" . $count . ")",
$error_msg);
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
$info = '{"Modules":"'.implode(",",$modules_).'","Agents":"'.implode(",",$agents_).'"}';
if ($success > 0) {
db_pandora_audit("Massive management", "Edit module", false, false, $info);
}

View File

@ -77,7 +77,7 @@ switch ($action) {
ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'));
$info = 'Alert: ' . json_encode($id_disabled_alerts);
$info = '{"Alert":"'.implode(",",$id_disabled_alerts).'"}';
if ($result) {
db_pandora_audit("Massive management", "Enable alert", false, false, $info);
}
@ -95,7 +95,7 @@ switch ($action) {
ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'));
$info = 'Alert: ' . json_encode($id_enabled_alerts);
$info = '{"Alert":"'.implode(",",$id_enabled_alerts).'"}';
if ($result) {
db_pandora_audit("Massive management", "Disable alert", false, false, $info);
}

View File

@ -77,7 +77,7 @@ switch($action) {
ui_print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
$info = 'Alert: ' . json_encode($id_standby_alerts);
$info = '{"Alert":"'.implode(",",$id_standby_alerts).'"}';
if ($result) {
db_pandora_audit("Massive management", "Set off standby alerts", false, false, $info);
}
@ -95,7 +95,7 @@ switch($action) {
ui_print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
$info = '{"Alert":"'.implode(",",$id_not_standby_alerts).'"}';
if ($result) {
db_pandora_audit("Massive management", "Set on standby alerts", false, false, $info);
}

View File

@ -182,40 +182,30 @@ if ($update_profile) {
if ($name) {
$ret = db_process_sql_update('tperfil', $values, array('id_perfil' => $id_profile));
if ($ret !== false) {
$info = 'Name: ' . $name .
' Incident view: ' . $incident_view .
' Incident edit: ' . $incident_edit .
' Incident management: ' . $incident_management .
' Agent view: ' . $agent_view .
' Agent edit: ' . $agent_edit .
' Agent disable: ' . $agent_disable .
' Alert edit: ' . $alert_edit .
' Alert management: ' . $alert_management .
' User management: ' . $user_management .
' DB management: ' . $db_management .
' Event view: ' . $event_view .
' Event edit: ' . $event_edit .
' Event management: ' . $event_management .
' Report view: ' . $report_view .
' Report edit: ' . $report_edit .
' Report management: ' . $report_management .
' Network map view: ' . $map_view .
' Network map edit: ' . $map_edit .
' Network map management: ' . $map_management .
' Visual console view: ' . $vconsole_view .
' Visual console edit: ' . $vconsole_edit .
' Visual console management: ' . $vconsole_management .
' Pandora Management: ' . $pandora_management;
$info = '{"Name":"'.$incident_view.'",
"Incident view":"'.$incident_view.'",
"Incident edit":"'.$incident_edit.'",
"Incident management":"'.$incident_management.'",
"Agent view":"'.$agent_view.'",
"Agent edit":"'.$agent_edit.'",
"Agent disable":"'.$agent_disable.'",
"Alert edit":"'.$alert_edit.'",
"Alert management":"'.$alert_management.'",
"User management":"'.$user_management.'",
"DB management":"'.$db_management.'",
"Event view":"'.$event_view.'",
"Event edit":"'.$event_edit.'",
"Event management":"'.$event_management.'",
"Report view":"'.$report_view.'",
"Report edit":"'.$report_edit.'",
"Report management":"'.$report_management.'",
"Network map view":"'.$map_view.'",
"Network map edit":"'.$map_edit.'",
"Network map management":"'.$map_management.'",
"Visual console view":"'.$vconsole_view.'",
"Visual console edit":"'.$vconsole_edit.'",
"Visual console management":"'.$vconsole_management.'",
"Pandora Management":"'.$pandora_management.'"}';
db_pandora_audit("User management",
"Update profile ". $name, false, false, $info);
@ -239,41 +229,30 @@ if ($create_profile) {
if ($ret !== false) {
ui_print_success_message(__('Successfully created'));
$info = 'Name: ' . $name .
' Incident view: ' . $incident_view .
' Incident edit: ' . $incident_edit .
' Incident management: ' . $incident_management .
' Agent view: ' . $agent_view .
' Agent edit: ' . $agent_edit .
' Agent disable: ' . $agent_disable .
' Alert edit: ' . $alert_edit .
' Alert management: ' . $alert_management .
' User management: ' . $user_management .
' DB management: ' . $db_management .
' Event view: ' . $event_view .
' Event edit: ' . $event_edit .
' Event management: ' . $event_management .
' Report view: ' . $report_view .
' Report edit: ' . $report_edit .
' Report management: ' . $report_management .
' Network map view: ' . $map_view .
' Network map edit: ' . $map_edit .
' Network map management: ' . $map_management .
' Visual console view: ' . $vconsole_view .
' Visual console edit: ' . $vconsole_edit .
' Visual console management: ' . $vconsole_management .
' Pandora Management: ' . $pandora_management;
$info = '{"Name":"'.$incident_view.'",
"Incident view":"'.$incident_view.'",
"Incident edit":"'.$incident_edit.'",
"Incident management":"'.$incident_management.'",
"Agent view":"'.$agent_view.'",
"Agent edit":"'.$agent_edit.'",
"Agent disable":"'.$agent_disable.'",
"Alert edit":"'.$alert_edit.'",
"Alert management":"'.$alert_management.'",
"User management":"'.$user_management.'",
"DB management":"'.$db_management.'",
"Event view":"'.$event_view.'",
"Event edit":"'.$event_edit.'",
"Event management":"'.$event_management.'",
"Report view":"'.$report_view.'",
"Report edit":"'.$report_edit.'",
"Report management":"'.$report_management.'",
"Network map view":"'.$map_view.'",
"Network map edit":"'.$map_edit.'",
"Network map management":"'.$map_management.'",
"Visual console view":"'.$vconsole_view.'",
"Visual console edit":"'.$vconsole_edit.'",
"Visual console management":"'.$vconsole_management.'",
"Pandora Management":"'.$pandora_management.'"}';
db_pandora_audit("User management",
"Created profile ". $name, false, false, $info);