From bef267ca5fe6c1f6bf436d64b5a9ec26479b1738 Mon Sep 17 00:00:00 2001 From: James Campbell Date: Sun, 31 May 2015 22:13:38 +1000 Subject: [PATCH 1/4] Syslog ext doc update to reflect syslog-ng 3.5.1 Updated configuration in documentation to suit syslog-ng 3.5.1 (tested in Ubuntu LTS 14.04 Server) Added line to add to config.php to enable Syslog functionality --- doc/Extensions/Syslog.md | 60 +++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/doc/Extensions/Syslog.md b/doc/Extensions/Syslog.md index f0f9621fd..f2f4587c5 100644 --- a/doc/Extensions/Syslog.md +++ b/doc/Extensions/Syslog.md @@ -17,46 +17,56 @@ yum install syslog-ng Once syslog-ng is installed, edit the relevant config file (most likely /etc/syslog-ng/syslog-ng.conf) and paste the following: ```ssh +@version: 3.5 +@include "scl.conf" +@include "`scl-root`/system/tty10.conf" + # First, set some global options. options { - chain_hostnames(0); + chain_hostnames(off); flush_lines(0); - use_dns(1); # Search name with DNS of the machine - use_fqdn(1); # Use all FQDN name of the machine + use_dns(no); + use_fqdn(no); + owner("root"); + group("adm"); perm(0640); stats_freq(0); - keep_hostname(0); - log_fifo_size (1000); - time_reopen (10); - create_dirs (no); + bad_hostname("^gconfd$"); }; - - + +######################## +# Sources +######################## source s_sys { - system(); - internal(); + system(); + internal(); }; - - + source s_net { - udp(port(514) flags(syslog-protocol)); tcp(port(514) flags(syslog-protocol)); + udp(port(514) flags(syslog-protocol)); }; - - + +######################## +# Destinations +######################## destination d_librenms { program("/opt/librenms/syslog.php" template ("$HOST||$FACILITY||$PRIORITY||$LEVEL||$TAG||$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC||$MSG||$PROGRAM\n") template-escape(yes)); }; - - + +######################## +# Log paths +######################## log { source(s_net); source(s_sys); destination(d_librenms); }; - - -@include "/etc/syslog-ng/conf.d/" + +### +# Include all config files in /etc/syslog-ng/conf.d/ +### +@include "/etc/syslog-ng/conf.d/*.conf" ``` Next start syslog-ng: @@ -65,6 +75,12 @@ Next start syslog-ng: service syslog-ng restart ``` +Add the following to your LibreNMS config.php file to enable the Syslog extension: + +```ssh +$config['enable_syslog'] = 1; +``` + ### Client configuration Below are sample configurations for a variety of clients. You should understand the config before using it as you may want to make some slight changes. @@ -105,4 +121,4 @@ logging librenms.ip logging server librenms.ip 5 use-vrf default facility local6 ``` -If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web ui. +If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web UI. From edada217fb65b4d544900838fbff1bb06c6b51f7 Mon Sep 17 00:00:00 2001 From: James Campbell Date: Mon, 1 Jun 2015 06:39:25 +1000 Subject: [PATCH 2/4] Revert "Syslog ext doc update to reflect syslog-ng 3.5.1" This reverts commit bef267ca5fe6c1f6bf436d64b5a9ec26479b1738. --- doc/Extensions/Syslog.md | 60 +++++++++++++++------------------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/doc/Extensions/Syslog.md b/doc/Extensions/Syslog.md index f2f4587c5..f0f9621fd 100644 --- a/doc/Extensions/Syslog.md +++ b/doc/Extensions/Syslog.md @@ -17,56 +17,46 @@ yum install syslog-ng Once syslog-ng is installed, edit the relevant config file (most likely /etc/syslog-ng/syslog-ng.conf) and paste the following: ```ssh -@version: 3.5 -@include "scl.conf" -@include "`scl-root`/system/tty10.conf" - # First, set some global options. options { - chain_hostnames(off); + chain_hostnames(0); flush_lines(0); - use_dns(no); - use_fqdn(no); - owner("root"); - group("adm"); + use_dns(1); # Search name with DNS of the machine + use_fqdn(1); # Use all FQDN name of the machine perm(0640); stats_freq(0); - bad_hostname("^gconfd$"); + keep_hostname(0); + log_fifo_size (1000); + time_reopen (10); + create_dirs (no); }; - -######################## -# Sources -######################## + + source s_sys { - system(); - internal(); + system(); + internal(); }; - + + source s_net { - tcp(port(514) flags(syslog-protocol)); udp(port(514) flags(syslog-protocol)); + tcp(port(514) flags(syslog-protocol)); }; - -######################## -# Destinations -######################## + + destination d_librenms { program("/opt/librenms/syslog.php" template ("$HOST||$FACILITY||$PRIORITY||$LEVEL||$TAG||$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC||$MSG||$PROGRAM\n") template-escape(yes)); }; - -######################## -# Log paths -######################## + + log { source(s_net); source(s_sys); destination(d_librenms); }; - -### -# Include all config files in /etc/syslog-ng/conf.d/ -### -@include "/etc/syslog-ng/conf.d/*.conf" + + +@include "/etc/syslog-ng/conf.d/" ``` Next start syslog-ng: @@ -75,12 +65,6 @@ Next start syslog-ng: service syslog-ng restart ``` -Add the following to your LibreNMS config.php file to enable the Syslog extension: - -```ssh -$config['enable_syslog'] = 1; -``` - ### Client configuration Below are sample configurations for a variety of clients. You should understand the config before using it as you may want to make some slight changes. @@ -121,4 +105,4 @@ logging librenms.ip logging server librenms.ip 5 use-vrf default facility local6 ``` -If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web UI. +If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web ui. From 7e96118c940948a00481de156364f78a2e900144 Mon Sep 17 00:00:00 2001 From: James Campbell Date: Mon, 1 Jun 2015 06:42:32 +1000 Subject: [PATCH 3/4] Syslog.md update to reflect syslog-ng 3.5.1 Updated configuration in documentation to suit syslog-ng 3.5.1 (tested in Ubuntu LTS 14.04 Server) Added line to add to config.php to enable Syslog functionality --- doc/Extensions/Syslog.md | 60 +++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/doc/Extensions/Syslog.md b/doc/Extensions/Syslog.md index f0f9621fd..315bc1810 100644 --- a/doc/Extensions/Syslog.md +++ b/doc/Extensions/Syslog.md @@ -17,46 +17,56 @@ yum install syslog-ng Once syslog-ng is installed, edit the relevant config file (most likely /etc/syslog-ng/syslog-ng.conf) and paste the following: ```ssh +@version: 3.5 +@include "scl.conf" +@include "`scl-root`/system/tty10.conf" + # First, set some global options. options { - chain_hostnames(0); + chain_hostnames(off); flush_lines(0); - use_dns(1); # Search name with DNS of the machine - use_fqdn(1); # Use all FQDN name of the machine + use_dns(no); + use_fqdn(no); + owner("root"); + group("adm"); perm(0640); stats_freq(0); - keep_hostname(0); - log_fifo_size (1000); - time_reopen (10); - create_dirs (no); + bad_hostname("^gconfd$"); }; - - + +######################## +# Sources +######################## source s_sys { - system(); - internal(); + system(); + internal(); }; - - + source s_net { - udp(port(514) flags(syslog-protocol)); tcp(port(514) flags(syslog-protocol)); + udp(port(514) flags(syslog-protocol)); }; - - + +######################## +# Destinations +######################## destination d_librenms { program("/opt/librenms/syslog.php" template ("$HOST||$FACILITY||$PRIORITY||$LEVEL||$TAG||$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC||$MSG||$PROGRAM\n") template-escape(yes)); }; - - + +######################## +# Log paths +######################## log { source(s_net); source(s_sys); destination(d_librenms); }; - - -@include "/etc/syslog-ng/conf.d/" + +### +# Include all config files in /etc/syslog-ng/conf.d/ +### +@include "/etc/syslog-ng/conf.d/*.conf" ``` Next start syslog-ng: @@ -65,6 +75,12 @@ Next start syslog-ng: service syslog-ng restart ``` +Add the following to your LibreNMS config.php file to enable the Syslog extension: + +```ssh +$config['enable_syslog'] = 1; +``` + ### Client configuration Below are sample configurations for a variety of clients. You should understand the config before using it as you may want to make some slight changes. @@ -105,4 +121,4 @@ logging librenms.ip logging server librenms.ip 5 use-vrf default facility local6 ``` -If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web ui. +If you have permitted udp and tcp 514 through any firewall then that should be all you need. Logs should start appearing and displayed within the LibreNMS web UI. From 8a774cd5a6ea19a374013b64922543db44636c7e Mon Sep 17 00:00:00 2001 From: James Campbell Date: Mon, 1 Jun 2015 06:44:58 +1000 Subject: [PATCH 4/4] Adjust formatting as requested by @laf --- doc/Extensions/Syslog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Extensions/Syslog.md b/doc/Extensions/Syslog.md index 315bc1810..b34f9405a 100644 --- a/doc/Extensions/Syslog.md +++ b/doc/Extensions/Syslog.md @@ -26,7 +26,7 @@ options { chain_hostnames(off); flush_lines(0); use_dns(no); - use_fqdn(no); + use_fqdn(no); owner("root"); group("adm"); perm(0640);