webui: Graylog table refresh (#7832)

* initial release

* style fixes
This commit is contained in:
crcro 2017-12-24 21:59:16 +02:00 committed by Neil Lathwood
parent 3f0ad0360e
commit 520fc4a268
4 changed files with 40 additions and 11 deletions

View File

@ -20,17 +20,18 @@
if (empty($results_limit)) {
$results_limit = 25;
}
$tmp_output = '<h3>Graylog</h3>
$tmp_output = '
<div class="table-responsive">
<table id="graylog" class="table table-hover table-condensed graylog">
<thead>
<tr>
<th data-column-id="timestamp" data-formatter="browserTime">Timestamp</th>
<th data-column-id="rowLabel"></th>
<th data-column-id="timestamp">Timestamp</th>
<th data-column-id="level">Level</th>
<th data-column-id="source">Source</th>
<th data-column-id="message">Message</th>
<th data-column-id="facility" data-visible="false">Facility</th>
<th data-column-id="level" data-visible="false">Level</th>
<th data-column-id="facility">Facility</th>
</tr>
</thead>
</table>
@ -112,7 +113,7 @@ $tmp_output .= '
},
';
if (isset($no_form) && $no_form !== true) {
if (!isset($no_form) && $no_form !== true) {
$tmp_output .= '
templates: {
header: searchbar

View File

@ -81,11 +81,12 @@ foreach ($messages['messages'] as $message) {
$response[] = array(
'timestamp' => $displayTime,
'source' => '<a href="'.generate_url(array('page'=>'device', 'device'=>$message['message']['source'])).'">'.$message['message']['source'].'</a>',
'message' => $message['message']['message'],
'facility' => $message['message']['facility'],
'level' => $message['message']['level'],
'rowLabel' => graylog_severity_label($message['message']['level']),
'timestamp' => $displayTime,
'source' => '<a href="'.generate_url(array('page'=>'device', 'device'=>$message['message']['source'])).'">'.$message['message']['source'].'</a>',
'message' => $message['message']['message'],
'facility' => $message['message']['facility'],
'level' => $message['message']['level'],
);
}

View File

@ -1,5 +1,7 @@
<?php
/*
* LibreNMS
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@ -12,7 +14,15 @@
* @copyright 2017 LibreNMS
* @author LibreNMS Contributors
*/
$no_refresh = true;
$pagetitle[] = 'Graylog';
echo '<div class="panel panel-default panel-condensed">
<div class="panel-heading">
<strong>Graylog entries</strong>
</div>';
require_once 'includes/common/graylog.inc.php';
echo implode('', $common_output);
echo '</div>';

View File

@ -55,6 +55,23 @@ function generate_priority_status($priority)
return isset($map[$priority]) ? $map[$priority] : 0;
}
function graylog_severity_label($severity)
{
$map = array(
"0" => "label-danger",
"1" => "label-danger",
"2" => "label-danger",
"3" => "label-danger",
"4" => "label-warning",
"5" => "label-info",
"6" => "label-info",
"7" => "label-default",
"" => "label-info",
);
$barColor = isset($map[$severity]) ? $map[$severity] : 'label-info';
return '<span class="alert-status '.$barColor .'">&nbsp;</span>';
}
function external_exec($command)
{
global $debug,$vdebug;