Files
librenms-librenms/doc/Extensions/Graylog.md

78 lines
3.5 KiB
Markdown
Raw Normal View History

source: Extensions/Graylog.md
path: blob/master/doc/
# Graylog integration
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.
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
`$PreserveFQDN on`
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.
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.
Config is simple, here's an example based on Graylog 2.4:
```php
$config['graylog']['server'] = 'http://127.0.0.1';
$config['graylog']['port'] = 9000;
$config['graylog']['username'] = 'admin';
$config['graylog']['password'] = 'admin';
$config['graylog']['version'] = '2.4';
```
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:
```php
$config['graylog']['timezone'] = 'Europe/Bucharest';
```
> Timezone must be PHP supported timezones, available at: <a href="http://php.net/manual/en/timezones.php">http://php.net/manual/en/timezones.php</a>
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/';`
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.
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']`.
Graylog entry matching device if source is not hostname or primary ip (#10458) * Added findByHostnameOrIp($hostnameOrIp) for devices. Returns Device or null Fixed Graylog device links, "device" parameter in URL was IP or Hostname instead of device id before Added Severity number to name conversion. Can be activated by setting $config['graylog']['severity-names'] = "true" in config Added Facility number to name conversion. Can be activated by setting $config['graylog']['facility-names'] = "true" in config * Added $config['graylog']['match-any-address']. To enable matching Graylog entries by any interface address set to "true" Added code to match Graylog entries by any interface address instead of only hostname or primary address * Fixed missing quotation marks in <script> block in includes/html/common/graylog.inc.php:46, causing graylog page only load header with empty table. Introduced in https://github.com/librenms/librenms/pull/10447 * Modified code to reduce complexity as mentioned by codeclimate * Changed findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Added Language File "syslog.php" for Syslog Severity and Facility Merged functions "levelName($level)" and "facilityName($facility)" to "syslogPrioParser($type, $value)" where $type should be "facility" or "severity" and $value the numeric or text facility or severity. Returns "NUMBER (NAME)" if possible, otherwhise returns $value * Shortened findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Add shortcut ipv4 and ipv6 device relationships Better code for adding source addresses Only translate level and facility if they are numeric Allow level and facility to be sortable No need for device link if we know it won't work. Before the code was punting to save sql queries. * Cache devices Took queries from 69 to 6 in my quick test. * Added Documentation for $config['graylog']['match-any-address'] * Fixed missing quotation marks in app/ApiClients/GraylogApi.php:125
2019-07-26 22:13:35 +02: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';
## Suppressing/enabling the domain part of a hostname for specific platforms
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)
```
router(config)# logging origin-id hostname
```
or
```
router(config)# logging origin-id string
```
### JunOS (Juniper Networks)
```
set system syslog host yourlogserver.corp log-prefix YOUR_PREFERRED_STRING
```
### PanOS (Palo Alto Networks)
```
set deviceconfig setting management hostname-type-in-syslog hostname
```
or
```
set deviceconfig setting management hostname-type-in-syslog FQDN
```