mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui: Timezone support for graylog (#7799)
* added timezone support for graylog * using default user timezone if none is configured * newline fix, added copyrights * copyright correction * copyright correction * copyright fix
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
@@ -10,7 +9,13 @@
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
if (empty($results_limit)) {
|
||||
$results_limit = 25;
|
||||
@@ -21,7 +26,7 @@ $tmp_output = '<h3>Graylog</h3>
|
||||
<table id="graylog" class="table table-hover table-condensed graylog">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="timestamp">Timestamp</th>
|
||||
<th data-column-id="timestamp" data-formatter="browserTime">Timestamp</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>
|
||||
@@ -71,6 +76,12 @@ if (empty($filter_device) && isset($_POST['hostname'])) {
|
||||
$filter_device = mres($_POST['hostname']);
|
||||
}
|
||||
|
||||
if (isset($config['graylog']['timezone'])) {
|
||||
$timezone = 'row.timestamp;';
|
||||
} else {
|
||||
$timezone = 'moment.parseZone(row.timestamp).local().format("YYYY-MM-DD HH:MM:SS");';
|
||||
}
|
||||
|
||||
$tmp_output .= '
|
||||
"<div class=\"form-group\"><select name=\"range\" class=\"form-group input-sm\">"+
|
||||
"<option value=\"300\">Search last 5 minutes</option>"+
|
||||
@@ -94,6 +105,11 @@ $tmp_output .= '
|
||||
var graylog_grid = $("#graylog").bootgrid({
|
||||
ajax: true,
|
||||
rowCount: ['. $results_limit .', 25,50,100,250,-1],
|
||||
formatters: {
|
||||
"browserTime": function(column, row) {
|
||||
return '.$timezone.'
|
||||
}
|
||||
},
|
||||
';
|
||||
|
||||
if (isset($no_form) && $no_form !== true) {
|
||||
|
||||
Reference in New Issue
Block a user