Merge branch 'ent-3837-7848-campo-id_source_event-en-vista-de-eventos-y-poder-filtrar-por-este' into 'develop'
Add new search for id source event in metaconsole See merge request artica/pandorafms!2438
This commit is contained in:
commit
ed0ad76e61
|
@ -83,7 +83,10 @@ CREATE TABLE `tremote_command_target` (
|
|||
|
||||
INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1);
|
||||
|
||||
|
||||
ALTER TABLE `tcredential_store` MODIFY COLUMN `product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE', 'SAP') default 'CUSTOM';
|
||||
ALTER TABLE `tevent_filter` ADD COLUMN `id_source_event` int(10);
|
||||
|
||||
|
||||
ALTER TABLE `tmetaconsole_agent_secondary_group` ADD INDEX `id_tagente` (`id_tagente`);
|
||||
ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`);
|
||||
|
|
|
@ -1395,6 +1395,7 @@ ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
|
|||
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
|
||||
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
|
|
@ -588,6 +588,18 @@ $table->data[23][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255,
|
|||
$table->data[24][0] = '<b>'.__('Comment').'</b>';
|
||||
$table->data[24][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$table->data[25][0] = '<b>'.__('Id souce event').'</b>';
|
||||
$table->data[25][1] = html_print_input_text(
|
||||
'id_source_event',
|
||||
$id_source_event,
|
||||
'',
|
||||
35,
|
||||
255,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=edit_filter&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ $delete_event = get_parameter('delete_event', 0);
|
|||
$get_event_filters = get_parameter('get_event_filters', 0);
|
||||
$get_comments = get_parameter('get_comments', 0);
|
||||
$get_events_fired = (bool) get_parameter('get_events_fired');
|
||||
|
||||
$get_id_source_event = get_parameter('get_id_source_event');
|
||||
if ($get_comments) {
|
||||
$event = get_parameter('event', false);
|
||||
$filter = get_parameter('filter', false);
|
||||
|
@ -253,7 +253,7 @@ if ($save_event_filter) {
|
|||
$values['source'] = get_parameter('source');
|
||||
$values['id_extra'] = get_parameter('id_extra');
|
||||
$values['user_comment'] = get_parameter('user_comment');
|
||||
|
||||
$values['id_source_event'] = get_parameter('id_source_event');
|
||||
$exists = (bool) db_get_value_filter(
|
||||
'id_filter',
|
||||
'tevent_filter',
|
||||
|
@ -300,6 +300,7 @@ if ($update_event_filter) {
|
|||
$values['source'] = get_parameter('source');
|
||||
$values['id_extra'] = get_parameter('id_extra');
|
||||
$values['user_comment'] = get_parameter('user_comment');
|
||||
$values['id_source_event'] = get_parameter('id_source_event');
|
||||
|
||||
if (io_safe_output($values['tag_with']) == '["0"]') {
|
||||
$values['tag_with'] = '[]';
|
||||
|
@ -465,6 +466,8 @@ function load_form_filter() {
|
|||
$("#text-id_extra").val(val);
|
||||
if (i == 'user_comment')
|
||||
$("#text-user_comment").val(val);
|
||||
if (i == 'id_source_event')
|
||||
$("#text-id_source_event").val(val);
|
||||
});
|
||||
reorder_tags_inputs();
|
||||
// Update the info with the loaded filter
|
||||
|
@ -685,7 +688,8 @@ function save_new_filter() {
|
|||
"date_to": $("#text-date_to").val(),
|
||||
"source": $("#text-source").val(),
|
||||
"id_extra": $("#text-id_extra").val(),
|
||||
"user_comment": $("#text-user_comment").val()
|
||||
"user_comment": $("#text-user_comment").val(),
|
||||
"id_source_event": $("#text-id_source_event").val()
|
||||
},
|
||||
function (data) {
|
||||
$("#info_box").hide();
|
||||
|
@ -754,7 +758,9 @@ function save_update_filter() {
|
|||
"date_to": $("#text-date_to").val(),
|
||||
"source": $("#text-source").val(),
|
||||
"id_extra": $("#text-id_extra").val(),
|
||||
"user_comment": $("#text-user_comment").val()
|
||||
"user_comment": $("#text-user_comment").val(),
|
||||
"id_source_event": $("#text-id_source_event").val()
|
||||
|
||||
},
|
||||
function (data) {
|
||||
$(".info_box").hide();
|
||||
|
|
|
@ -35,7 +35,9 @@ enterprise_include_once('include/functions_metaconsole.php');
|
|||
enterprise_include_once('meta/include/functions_events_meta.php');
|
||||
enterprise_include_once('meta/include/functions_agents_meta.php');
|
||||
enterprise_include_once('meta/include/functions_modules_meta.php');
|
||||
enterprise_include_once('meta/include/functions_events_meta.php');
|
||||
if (is_metaconsole()) {
|
||||
$id_source_event = get_parameter('id_source_event');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -926,6 +928,16 @@ function events_get_all(
|
|||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
// Id source event.
|
||||
if (!empty($filter['id_source_event'])) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND lower(te.id_source_event) like lower("%%%s%%") ',
|
||||
$filter['id_source_event']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// User comment.
|
||||
if (!empty($filter['user_comment'])) {
|
||||
$sql_filters[] = sprintf(
|
||||
|
@ -1498,6 +1510,13 @@ function events_get_events_grouped(
|
|||
$groupby_extra = '';
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$id_source_event = get_parameter('id_source_event');
|
||||
if ($id_source_event != '') {
|
||||
$sql_post .= "AND id_source_event = $id_source_event";
|
||||
}
|
||||
}
|
||||
|
||||
db_process_sql('SET group_concat_max_len = 9999999');
|
||||
$event_lj = events_get_secondary_groups_left_join($table);
|
||||
if ($total) {
|
||||
|
|
|
@ -231,6 +231,13 @@ if ($source != '') {
|
|||
$sql_post .= " AND source LIKE '%$source%'";
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if ($id_source_event != '') {
|
||||
$sql_post .= " AND id_source_event LIKE '%$id_source_event%'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// In metaconsole mode the agent search is performed by name.
|
||||
if ($meta) {
|
||||
$text_agent = get_parameter('text_agent', '');
|
||||
|
|
|
@ -197,6 +197,10 @@ $history = get_parameter(
|
|||
);
|
||||
$section = get_parameter('section', false);
|
||||
|
||||
$id_source_event = get_parameter(
|
||||
'filter[id_source_event]',
|
||||
$filter['id_source_event']
|
||||
);
|
||||
// Ajax responses.
|
||||
if (is_ajax()) {
|
||||
$get_events = get_parameter('get_events', 0);
|
||||
|
@ -396,6 +400,7 @@ if ($user_filter !== false) {
|
|||
$source = $filter['source'];
|
||||
$id_extra = $filter['id_extra'];
|
||||
$user_comment = $filter['user_comment'];
|
||||
$id_source_event = $filter['id_source_event'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,6 +1056,20 @@ $in = '<div class="filter_input"><label>'.__('Alert events').'</label>';
|
|||
$in .= $data.'</div>';
|
||||
$adv_inputs[] = $in;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$data = html_print_input_text(
|
||||
'id_source_event',
|
||||
$id_source_event,
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
true
|
||||
);
|
||||
$in = '<div class="filter_input"><label>'.__('Id source event').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$adv_inputs[] = $in;
|
||||
}
|
||||
|
||||
// Gap.
|
||||
$adv_inputs[] = '<div class="filter_input"></div>';
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ check_login();
|
|||
|
||||
$sort_field = get_parameter('sort_field', 'timestamp');
|
||||
$sort_order = get_parameter('sort', 'down');
|
||||
if (is_metaconsole()) {
|
||||
$id_source_event = get_parameter('id_source_event');
|
||||
}
|
||||
|
||||
$event_a = check_acl($config['id_user'], 0, 'ER');
|
||||
$event_w = check_acl($config['id_user'], 0, 'EW');
|
||||
|
@ -125,6 +128,10 @@ if (is_ajax()) {
|
|||
$values['id_extra'] = get_parameter('id_extra');
|
||||
$values['user_comment'] = get_parameter('user_comment');
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$values['id_source_event'] = get_parameter('id_source_event');
|
||||
}
|
||||
|
||||
$exists = (bool) db_get_value_filter(
|
||||
'id_filter',
|
||||
'tevent_filter',
|
||||
|
@ -172,6 +179,10 @@ if (is_ajax()) {
|
|||
$values['id_extra'] = get_parameter('id_extra');
|
||||
$values['user_comment'] = get_parameter('user_comment');
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$values['id_source_event'] = get_parameter('id_source_event');
|
||||
}
|
||||
|
||||
if (io_safe_output($values['tag_with']) == '["0"]') {
|
||||
$values['tag_with'] = '[]';
|
||||
}
|
||||
|
@ -984,6 +995,18 @@ $data[2] .= html_print_input_text(
|
|||
255,
|
||||
true
|
||||
);
|
||||
if (is_metaconsole()) {
|
||||
$data[3] = __('Id source event').$jump;
|
||||
$data[3] .= html_print_input_text(
|
||||
'id_source_event',
|
||||
$id_source_event,
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
|
@ -1115,7 +1138,7 @@ if ($group_rep == 0) {
|
|||
$sql = "SELECT DISTINCT te.*, 1 event_rep,
|
||||
(SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name
|
||||
FROM $event_table te $event_lj
|
||||
WHERE 1=1 ".$sql_post."
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
$order_sql LIMIT ".$offset.','.$pagination;
|
||||
|
||||
// Extract the events by filter (or not) from db.
|
||||
|
@ -1152,12 +1175,14 @@ enterprise_hook(
|
|||
[
|
||||
$filter_resume,
|
||||
[
|
||||
'status' => $fields,
|
||||
'event_type' => $types,
|
||||
'severity' => $severities,
|
||||
'duplicate' => $repeated_sel,
|
||||
'alerts' => $alert_events_titles,
|
||||
'groups' => $user_groups_array,
|
||||
'status' => $fields,
|
||||
'event_type' => $types,
|
||||
'severity' => $severities,
|
||||
'duplicate' => $repeated_sel,
|
||||
'alerts' => $alert_events_titles,
|
||||
'groups' => $user_groups_array,
|
||||
'id_source_event' => $id_source_event,
|
||||
|
||||
],
|
||||
]
|
||||
);
|
||||
|
@ -1186,10 +1211,10 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) {
|
|||
}
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT COUNT(DISTINCT id_evento)
|
||||
$sql = 'SELECT COUNT(DISTINCT id_evento)
|
||||
FROM $event_table te
|
||||
$event_lj
|
||||
WHERE 1=1 $sql_post";
|
||||
WHERE 1=1 $sql_post';
|
||||
$total_events = (int) db_get_sql($sql);
|
||||
} else if ($group_rep == 1) {
|
||||
$total_events = events_get_events_grouped(
|
||||
|
@ -1202,10 +1227,10 @@ if ($group_rep == 0) {
|
|||
false
|
||||
);
|
||||
} else if ($group_rep == 2) {
|
||||
$sql = "SELECT COUNT(*) FROM (select id_agente as total from $event_table te
|
||||
$sql = 'SELECT COUNT(*) FROM (select id_agente as total from $event_table te
|
||||
$event_lj
|
||||
WHERE id_agente > 0
|
||||
$sql_post GROUP BY id_agente ORDER BY id_agente ) AS t";
|
||||
$sql_post GROUP BY id_agente ORDER BY id_agente ) AS t';
|
||||
$total_events = (int) db_get_sql($sql);
|
||||
}
|
||||
|
||||
|
@ -1336,6 +1361,8 @@ $(document).ready( function() {
|
|||
$("#text-id_extra").val(val);
|
||||
if (i == 'user_comment')
|
||||
$("#text-user_comment").val(val);
|
||||
if (i == 'id_source_event')
|
||||
$("#text-id_source_event").val(val);
|
||||
});
|
||||
reorder_tags_inputs();
|
||||
// Update the info with the loaded filter
|
||||
|
@ -1375,6 +1402,7 @@ $(document).ready( function() {
|
|||
$("#text-source").val('');
|
||||
$("#text-id_extra").val('');
|
||||
$("#text-user_comment").val('');
|
||||
$("#text-id_source_event").val('');
|
||||
|
||||
clear_tags_inputs();
|
||||
|
||||
|
@ -1449,6 +1477,10 @@ $(document).ready( function() {
|
|||
$("#text-id_extra").val(val);
|
||||
if (i == 'user_comment')
|
||||
$("#text-user_comment").val(val);
|
||||
|
||||
if(i == 'id_source_event')
|
||||
$("#text-id_source_event").val(val);
|
||||
}
|
||||
});
|
||||
reorder_tags_inputs();
|
||||
// Update the info with the loaded filter
|
||||
|
@ -1517,7 +1549,9 @@ $(document).ready( function() {
|
|||
"date_to": $("#text-date_to").val(),
|
||||
"source": $("#text-source").val(),
|
||||
"id_extra": $("#text-id_extra").val(),
|
||||
"user_comment": $("#text-user_comment").val()
|
||||
"user_comment": $("#text-user_comment").val(),
|
||||
"id_source_event": $("#text-id_source_event").val()
|
||||
|
||||
},
|
||||
function (data) {
|
||||
$(".info_box").hide();
|
||||
|
@ -1617,7 +1651,9 @@ $(document).ready( function() {
|
|||
"date_to": $("#text-date_to").val(),
|
||||
"source": $("#text-source").val(),
|
||||
"id_extra": $("#text-id_extra").val(),
|
||||
"user_comment": $("#text-user_comment").val()
|
||||
"user_comment": $("#text-user_comment").val(),
|
||||
"id_source_event": $("#text-id_source_event").val()
|
||||
|
||||
},
|
||||
function (data) {
|
||||
$(".info_box").hide();
|
||||
|
|
|
@ -1116,6 +1116,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
|
|||
`source` tinytext NOT NULL,
|
||||
`id_extra` tinytext NOT NULL,
|
||||
`user_comment` text NOT NULL,
|
||||
`id_source_event` int(10) NULL default 0,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue