Skip to content

Setup LibreNMS Logging

Enable Syslog Extension

sudo nano /opt/librenms/config.php

Set the following value:

$config['enable_syslog'] = 1;

Install syslog-ng

sudo apt install syslog-ng-core

Create and save the config file:

sudo nano /etc/syslog-ng/conf.d/librenms.conf

Paste the following into the file:

source s_net {
        tcp(port(514) flags(syslog-protocol));
        udp(port(514) flags(syslog-protocol));
};

destination d_librenms {
        program("/opt/librenms/syslog.php" template ("$HOST||$FACILITY||$PRIORITY||$LEVEL||$TAG||$R_YEAR-$R_MONTH-$R_DAY $R_HOUR:$R_MIN:$R_SEC||$MSG||$PROGRAM\n") template-escape(yes));
};

log {
        source(s_net);
        source(s_src);
        destination(d_librenms);
};

Start syslog-ng:

sudo service syslog-ng restart

Server Configuration

The configuration for Ubuntu 22.04 is located here.