mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Added Recent Graylog Entries to Device Overview (WIP) * Improved "Recent Graylog" entries on device overview (WIP) Added $config['graylog']['device-page']['rowCount'] to set maximum rows shown in "Recent Graylog" on device overview (Default: 10) Added $config['graylog']['device-page']['maxLevel'] to set the maximum message level shown in "Recent Graylog" on device overview (Default: 7, validates value to be >= 0 and <= 7) * Fixed code styling issue * Added Log Level filter to Graylog widget Added Log Level filter to Graylog pages (device pages and graylog overview) * Added documentation for new configuration options * Removed unneccesary (and already commented) using Renamed "maxLevel" to "loglevel" as suggested by a colleague * Added doc for $config['graylog']['loglevel'] * Removed includes/html/print-graylog.inc.php and inlined it in includes/html/pages/device/overview/graylog.inc.php Removed comma in json object in resources/views/widgets/graylog.blade.php Replaced translation strings in resources/views/widgets/settings/graylog.blade.php with existing translation strings * log level -> minimum log level * Use Config::get() default functionality * Oops
64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* GraylogController.php
|
|
*
|
|
* -Description-
|
|
*
|
|
* 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 option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* @package LibreNMS
|
|
* @link http://librenms.org
|
|
* @copyright 2018 Tony Murray
|
|
* @author Tony Murray <murraytony@gmail.com>
|
|
*/
|
|
|
|
namespace App\Http\Controllers\Widgets;
|
|
|
|
use App\Models\Device;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class GraylogController extends WidgetController
|
|
{
|
|
protected $title = 'Graylog';
|
|
protected $defaults = [
|
|
'title' => null,
|
|
'stream' => null,
|
|
'device' => null,
|
|
'range' => null,
|
|
'limit' => 15,
|
|
'loglevel' => null,
|
|
];
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return View
|
|
*/
|
|
public function getView(Request $request)
|
|
{
|
|
return view('widgets.graylog', $this->getSettings());
|
|
}
|
|
|
|
public function getSettingsView(Request $request)
|
|
{
|
|
$data = $this->getSettings(true);
|
|
|
|
if ($data['device']) {
|
|
$data['device'] = Device::find($data['device']);
|
|
}
|
|
|
|
return view('widgets.settings.graylog', $data);
|
|
}
|
|
}
|