mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
#12344 Fixed log source
This commit is contained in:
parent
c48414ac8a
commit
ed1ae83770
@ -1718,3 +1718,5 @@ operation/incidents/list_integriaims_incidents.php
|
|||||||
include/functions_incidents.php
|
include/functions_incidents.php
|
||||||
include/functions_integriaims.php
|
include/functions_integriaims.php
|
||||||
include/ajax/integria_incidents.ajax.php
|
include/ajax/integria_incidents.ajax.php
|
||||||
|
enterprise/operation/log/log_source.php
|
||||||
|
enterprise/include/class/LogSource.class.php
|
||||||
|
@ -16,6 +16,8 @@ global $config;
|
|||||||
// Login check.
|
// Login check.
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
|
enterprise_include('include/functions_elasticsearch.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
@ -62,30 +64,58 @@ $table->style['source'] = 'width: 80%;';
|
|||||||
|
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data['agent_id'] = [0 => $agent_id];
|
||||||
|
$filter = elasticsearch_filter_build($data, 0);
|
||||||
|
$filter['aggs'] = [
|
||||||
|
'results' => [
|
||||||
|
'composite' => [
|
||||||
|
'sources' => [
|
||||||
|
[
|
||||||
|
'source_id' => [
|
||||||
|
'terms' => [
|
||||||
|
'script' => ['source' => "params['_source'].source_id"],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$logs = elasticsearch_curl(
|
||||||
|
$filter,
|
||||||
|
$config['elasticsearch_ip'],
|
||||||
|
$config['elasticsearch_port'],
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'desc',
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
$logs = json_decode($logs);
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
if (empty($logs->aggregations) === false) {
|
||||||
|
$buckets = $logs->aggregations->results->buckets;
|
||||||
// Get most recent sources for active agent.
|
foreach ($buckets as $key => $bucket) {
|
||||||
$sql = "select source, MAX(utimestamp) AS last_contact from tagent_module_log where id_agent=$agent_id GROUP BY source";
|
$source = $bucket->key->source_id;
|
||||||
|
$row['source'] = $source;
|
||||||
$logs = mysql_db_get_all_rows_sql($sql);
|
$row['review'] = '<a href="javascript:void(0)">'.html_print_image('images/zoom.png', true, ['title' => __('Review in log viewer'), 'alt' => '', 'onclick' => "send_form('".$source.'-'.$agent_id."')"]).'</a>';
|
||||||
|
$row['last_contact'] = html_print_image(
|
||||||
foreach ($logs as $log) {
|
'images/spinner.gif',
|
||||||
$row['source'] = $log['source'];
|
true,
|
||||||
$row['review'] = '<a href="javascript:void(0)">'.html_print_image('images/zoom.png', true, ['title' => __('Review in log viewer'), 'alt' => '', 'onclick' => "send_form('".$log['source'].'-'.$agent_id."')"]).'</a>';
|
[
|
||||||
$row['last_contact'] = html_print_image(
|
'id' => 'img-'.$source,
|
||||||
'images/spinner.gif',
|
'border' => '0',
|
||||||
true,
|
'width' => '20px',
|
||||||
[
|
'heigth' => '20px',
|
||||||
'id' => 'img-'.$log['source'],
|
'onload' => "get_last_contact('".$source."', '".$agent_id."')",
|
||||||
'border' => '0',
|
]
|
||||||
'width' => '20px',
|
);
|
||||||
'heigth' => '20px',
|
$table->data[$source] = $row;
|
||||||
'onload' => "get_last_contact('".$log['source']."', '".$agent_id."')",
|
}
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->data[$log['source']] = $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user