2016-08-24 08:12:20 +01:00
|
|
|
source: Extensions/Graylog.md
|
2018-10-27 23:04:34 +01:00
|
|
|
path: blob/master/doc/
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2015-08-11 09:44:35 -07:00
|
|
|
# Graylog integration
|
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
We have simple integration for Graylog, you will be able to view any
|
|
|
|
|
logs from within LibreNMS that have been parsed by the syslog input
|
|
|
|
|
from within Graylog itself. This includes logs from devices which
|
|
|
|
|
aren't in LibreNMS still, you can also see logs for a specific device
|
|
|
|
|
under the logs section for the device.
|
2015-08-11 09:44:35 -07:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Currently, LibreNMS does not associate shortnames from Graylog with
|
|
|
|
|
full FQDNS. If you have your devices in LibreNMS using full FQDNs,
|
|
|
|
|
such as hostname.example.com, be aware that rsyslogd, by default,
|
|
|
|
|
sends the shortname only. To fix this, add
|
2016-10-05 01:09:46 -07:00
|
|
|
|
|
|
|
|
`$PreserveFQDN on`
|
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
to your rsyslog config to send the full FQDN so device logs will be
|
|
|
|
|
associated correctly in LibreNMS. Also see near the bottom of this
|
|
|
|
|
document for tips on how to enable/suppress the domain part of
|
|
|
|
|
hostnames in syslog-messages for some platforms.
|
2016-10-05 01:09:46 -07:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Graylog itself isn't included within LibreNMS, you will need to
|
|
|
|
|
install this separately either on the same infrastructure as LibreNMS
|
|
|
|
|
or as a totally standalone appliance.
|
2015-08-11 09:44:35 -07:00
|
|
|
|
2018-04-09 21:51:28 +02:00
|
|
|
Config is simple, here's an example based on Graylog 2.4:
|
2015-08-11 09:44:35 -07:00
|
|
|
|
|
|
|
|
```php
|
2016-09-14 04:23:52 +01:00
|
|
|
$config['graylog']['server'] = 'http://127.0.0.1';
|
2018-04-09 21:51:28 +02:00
|
|
|
$config['graylog']['port'] = 9000;
|
2015-08-11 09:44:35 -07:00
|
|
|
$config['graylog']['username'] = 'admin';
|
|
|
|
|
$config['graylog']['password'] = 'admin';
|
2018-04-09 21:51:28 +02:00
|
|
|
$config['graylog']['version'] = '2.4';
|
2015-08-11 09:44:35 -07:00
|
|
|
```
|
2016-09-14 04:23:52 +01:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Graylog messages are stored using GMT timezone. You can display
|
|
|
|
|
graylog messages in LibreNMS webui using your desired timezone by
|
|
|
|
|
setting following option in config.php:
|
2017-12-04 09:56:13 +02:00
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
$config['graylog']['timezone'] = 'Europe/Bucharest';
|
|
|
|
|
```
|
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Timezone must be PHP supported timezones, available at:
|
|
|
|
|
<http://php.net/manual/en/timezones.php>
|
|
|
|
|
|
|
|
|
|
If you are running a version earlier than Graylog then please set
|
|
|
|
|
`$config['graylog']['version']` to the version number of your Graylog
|
|
|
|
|
install. Earlier versions than 2.1 use the default port `12900`
|
|
|
|
|
|
|
|
|
|
If you have altered the default uri for your Graylog setup then you
|
|
|
|
|
can override the default of `/api/` using `$config['graylog']['base_uri'] = '/somepath/';`
|
2016-09-14 04:23:52 +01:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
If you choose to use another user besides the admin user, please note
|
|
|
|
|
that currently you must give the user "admin" permissions from within
|
|
|
|
|
Graylog, "read" permissions alone are not sufficient.
|
2016-10-05 01:09:46 -07:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
If you have enabled TLS for the Graylog API and you are using a
|
|
|
|
|
self-signed certificate, please make sure that the certificate is
|
|
|
|
|
trusted by your LibreNMS host, otherwise the connection will
|
|
|
|
|
fail. Additionally, the certificate's Common Name (CN) has to match
|
|
|
|
|
the FQDN or IP address specified in `$config['graylog']['server']`.
|
2016-10-05 01:09:46 -07:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
If you want to match the source address of the log entries against any
|
|
|
|
|
IP address of a device instead of only against the primary address and
|
|
|
|
|
the host name to assign the log entries to a device, you can activate
|
|
|
|
|
this function using $config['graylog']['match-any-address'] = 'true';
|
2018-03-15 22:46:50 +01:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
There are 2 configuration parameters to influence the behaviour of the
|
|
|
|
|
"Recent Graylog" table on the overview page of the
|
|
|
|
|
devices. $config['graylog']['device-page']['rowCount'] sets the
|
|
|
|
|
maximum number of rows to be displayed (default: 10) With
|
|
|
|
|
$config['graylog']['device-page']['loglevel'] you can set which
|
|
|
|
|
loglevels should be displayed on the overview page. (default: 7, min:
|
|
|
|
|
0, max: 7) $config['graylog']['device-page']['loglevel'] = 4 shows
|
|
|
|
|
only entries with a log level less than or equal to 4 (Emergency,
|
|
|
|
|
Alert, Critical, Error, Warning).
|
2019-07-26 22:13:35 +02:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
You can set a default Log Level Filter with
|
|
|
|
|
$config['graylog']['loglevel'] (applies to /graylog and
|
|
|
|
|
/device/device=/tab=logs/section=graylog/ (min: 0, max: 7)
|
2019-08-27 19:44:27 +02:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
# Suppressing/enabling the domain part of a hostname for specific platforms
|
2019-08-27 19:44:27 +02:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
You should see if what you get in syslog/Graylog matches up with your
|
|
|
|
|
configured hosts first. If you need to modify the syslog messages from
|
|
|
|
|
specific platforms, this may be of assistance:
|
|
|
|
|
|
|
|
|
|
## IOS (Cisco)
|
2018-03-15 22:46:50 +01:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
router(config)# logging origin-id hostname
|
|
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2018-03-15 22:46:50 +01:00
|
|
|
or
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2018-03-15 22:46:50 +01:00
|
|
|
```
|
|
|
|
|
router(config)# logging origin-id string
|
|
|
|
|
```
|
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
## JunOS (Juniper Networks)
|
|
|
|
|
|
2018-03-15 22:46:50 +01:00
|
|
|
```
|
|
|
|
|
set system syslog host yourlogserver.corp log-prefix YOUR_PREFERRED_STRING
|
|
|
|
|
```
|
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
## PanOS (Palo Alto Networks)
|
|
|
|
|
|
2018-03-15 22:46:50 +01:00
|
|
|
```
|
|
|
|
|
set deviceconfig setting management hostname-type-in-syslog hostname
|
|
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2018-03-15 22:46:50 +01:00
|
|
|
or
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
set deviceconfig setting management hostname-type-in-syslog FQDN
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|