#1001 new item report for group elastic log

This commit is contained in:
Daniel Cebrian 2023-05-10 17:47:20 +02:00
parent 476b38c221
commit 24848df3ba
7 changed files with 117 additions and 1 deletions

View File

@ -40,4 +40,6 @@ CREATE TABLE IF NOT EXISTS `tsesion_filter_log_viewer` (
ALTER TABLE `talert_template_module_actions` ADD COLUMN `recovered` TINYINT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
COMMIT;

View File

@ -321,6 +321,19 @@ switch ($action) {
$full_text = empty($es['full_text']) ? 0 : $es['full_text'];
break;
case 'event_report_log_table':
$period = $item['period'];
$period_range = $item['period_range'];
$description = $item['description'];
$es = json_decode($item['external_source'], true);
$id_agents = $es['id_agents'];
$source = $es['source'];
$search = $es['search'];
$log_number = empty($es['log_number']) ? $log_number : $es['log_number'];
$full_text = empty($es['full_text']) ? 0 : $es['full_text'];
break;
case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
@ -1025,6 +1038,7 @@ switch ($action) {
case 'prediction_date':
case 'simple_baseline_graph':
case 'event_report_log':
case 'event_report_log_table':
case 'increment':
$label = (isset($style['label'])) ? $style['label'] : '';
break;
@ -1413,6 +1427,29 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_period_range" class="datos">
<td class="bolder">
<?php
echo __('Period range');
ui_print_help_tip(
__('This is the time range in which the files are grouped. For example, 1 day will group the files by day and will count them.')
);
?>
</td>
<td >
<?php
html_print_extended_select_for_time(
'period_range',
$period_range,
'',
'',
'0',
10
);
?>
</td>
</tr>
<tr id="row_last_value" class="datos">
<td class="bolder" class="datos">
<?php
@ -5297,6 +5334,12 @@ $(document).ready (function () {
return false;
}
break;
case 'event_report_log_table':
if ($("#id_agents3").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
@ -6387,6 +6430,7 @@ function chooseType() {
$("#row_description").hide();
$("#row_label").hide();
$("#row_period").hide();
$("#row_period_range").hide();
$("#row_agent").hide();
$("#row_module").hide();
$("#row_period").hide();
@ -6561,7 +6605,22 @@ function chooseType() {
loadLogAgents();
break;
break;
case 'event_report_log_table':
$("#log_help_tip").css("visibility", "visible");
$("#row_description").show();
$("#row_period").show();
$("#row_period_range").show();
$("#row_search").show();
$("#row_log_number").show();
$("#agents_row").show();
$("#row_source").show();
$("#row_historical_db_check").hide();
loadLogAgents();
break;
case 'increment':
$("#row_description").show();

View File

@ -1613,6 +1613,25 @@ switch ($action) {
$good_format = true;
break;
case 'event_report_log_table':
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
$full_text = (integer) get_parameter('full_text', 0);
$log_number = get_parameter('log_number', '');
$es['source'] = $source;
$es['id_agents'] = $agents_to_report;
$es['search'] = $search;
$es['full_text'] = $full_text;
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period_range'] = get_parameter('period_range');
$good_format = true;
break;
case 'prediction_date':
$values['period'] = get_parameter('period1');
$values['top_n'] = get_parameter(
@ -2562,6 +2581,25 @@ switch ($action) {
$good_format = true;
break;
case 'event_report_log_table':
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
$full_text = (integer) get_parameter('full_text', 0);
$log_number = get_parameter('log_number', '');
$es['source'] = $source;
$es['id_agents'] = $agents_to_report;
$es['search'] = $search;
$es['full_text'] = $full_text;
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period_range'] = get_parameter('period_range');
$good_format = true;
break;
case 'agent_module':
case 'agent_module_status':
$agents_to_report_text = get_parameter('id_agents2-multiple-text');

View File

@ -412,6 +412,13 @@ function reporting_make_reporting_data(
);
break;
case 'event_report_log_table':
$report['contents'][] = reporting_log_table(
$report,
$content
);
break;
case 'increment':
$report['contents'][] = reporting_increment(
$report,

View File

@ -259,6 +259,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_log($table, $item);
break;
case 'event_report_log_table':
reporting_html_log_table($table, $item);
break;
case 'permissions_report':
reporting_html_permissions($table, $item);
break;

View File

@ -944,6 +944,11 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Log'),
'name' => __('Log report'),
];
$types['event_report_log_table'] = [
'optgroup' => __('Log'),
'name' => __('Log report by period'),
];
}
if ($template === false) {

View File

@ -1567,6 +1567,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`id_agent_module` BIGINT UNSIGNED NULL DEFAULT NULL,
`type` VARCHAR(30) DEFAULT 'simple_graph',
`period` INT NOT NULL DEFAULT 0,
`period_range` INT DEFAULT 0,
`order` INT NOT NULL DEFAULT 0,
`name` VARCHAR(300) NULL,
`description` MEDIUMTEXT,