Discussion:
[freenas/freenas] 4e295d2: Final (hopefully) changes and additions to add syslog-ng to freenas. There might be more tweaks needed for Truenas.
freenas-devel-PD4FTy7X32lNMZ+623a0Tti2O/
2014-10-21 03:21:23 UTC
Permalink
branch: master
Repository: freenas/freenas
Pushed by: git
Pushed to: branch master
commit 4e295d2dc24d285bad8a49816a4771bae4ae13f0
Author: Suraj Ravichandran <suraj-***@public.gmane.org>
Date: Mon Oct 20 19:25:20 2014 -0700

Final (hopefully) changes and additions to add syslog-ng to
freenas. There might be more tweaks needed for Truenas.

Ticket: #6207
---
build/nanobsd-cfg/Files/etc/rc.conf | 4 ++++
gui/middleware/notifier.py | 4 ++--
src/freenas/etc/ix.rc.d/ix-syslogd | 9 +++++++--
src/freenas/usr/local/etc/syslog-ng.conf.freenas | 3 ---
4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/build/nanobsd-cfg/Files/etc/rc.conf b/build/nanobsd-cfg/Files/etc/rc.conf
index e5825eb..bb43a52 100644
--- a/build/nanobsd-cfg/Files/etc/rc.conf
+++ b/build/nanobsd-cfg/Files/etc/rc.conf
@@ -76,3 +76,7 @@ early_late_divider="*"

# ZFS
root_rw_mount="YES"
+
+# syslog-ng
+syslogd_enable="NO"
+syslog_ng_enable="YES"
diff --git a/gui/middleware/notifier.py b/gui/middleware/notifier.py
index 5a8cd8b..94c83f8 100755
--- a/gui/middleware/notifier.py
+++ b/gui/middleware/notifier.py
@@ -926,11 +926,11 @@ class notifier:

def _restart_syslogd(self):
self._system("/usr/sbin/service ix-syslogd quietstart")
- self._system("/usr/sbin/service syslogd restart")
+ self._system("/etc/local/rc.d/syslog-ng restart")

def _start_syslogd(self):
self._system("/usr/sbin/service ix-syslogd quietstart")
- self._system("/usr/sbin/service syslogd start")
+ self._system("/etc/local/rc.d/syslog-ng start")

def _reload_tftp(self):
self._system("/usr/sbin/service ix-inetd quietstart")
diff --git a/src/freenas/etc/ix.rc.d/ix-syslogd b/src/freenas/etc/ix.rc.d/ix-syslogd
index 768fa7d..831e3fc 100755
--- a/src/freenas/etc/ix.rc.d/ix-syslogd
+++ b/src/freenas/etc/ix.rc.d/ix-syslogd
@@ -16,7 +16,7 @@ generate_syslog_conf()
eval local $f
local sf=$(var_to_sf $f)

- cp /conf/base/etc/syslog.conf /etc/syslog.conf
+ cp /conf/base/etc/local/syslog-ng.conf.freenas /etc/local/syslog-ng.conf

${FREENAS_SQLITE_CMD} ${FREENAS_CONFIG} "
SELECT
@@ -32,7 +32,12 @@ generate_syslog_conf()
" | \
while eval read -r $f; do
if [ -n "${stg_syslogserver}" ]; then
- echo -e "*.*\t@${stg_syslogserver}" >> /etc/syslog.conf
+{
+cat << __EOF__
+destination loghost { udp("${stg_syslogserver}" port(514) localport(514)); };
+log { source(src); destination(loghost); };
+__EOF__
+} >> /etc/local/syslog-ng.conf
fi
done
}
diff --git a/src/freenas/usr/local/etc/syslog-ng.conf.freenas b/src/freenas/usr/local/etc/syslog-ng.conf.freenas
index 90fa4c3..5c956d5 100644
--- a/src/freenas/usr/local/etc/syslog-ng.conf.freenas
+++ b/src/freenas/usr/local/etc/syslog-ng.conf.freenas
@@ -126,9 +126,6 @@ log { source(src); filter(f_lpr); filter(f_info); destination(lpd-errs); };
#
# ftp.info /var/log/xferlog
#
-# suraj edit : in freenas we have ftp.* instead of ftp.info so below is commented
-#log { source(src); filter(f_ftp); filter(f_info); destination(xferlog); };
-# suraj edit : and the below line is appropriate (i think)
log { source(src); filter(f_ftp); destination(xferlog); };

#
freenas-devel-PD4FTy7X32lNMZ+623a0Tti2O/
2014-10-21 03:21:22 UTC
Permalink
branch: master
Repository: freenas/freenas
Pushed by: git
Pushed to: branch master
commit 3f27592229a815470f52656cf481140ae0925d3e
Author: Suraj Ravichandran <suraj-***@public.gmane.org>
Date: Mon Oct 20 18:55:07 2014 -0700

Working around what is presumably a bug in syslog-ng
due to which it cannot send on udp port 514
and all bsd syslog clients must have it been sent form
this priviledged port, so we change its local port binding
to a different port (here 999)
---
src/freenas/usr/local/etc/syslog-ng.conf.freenas | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/freenas/usr/local/etc/syslog-ng.conf.freenas b/src/freenas/usr/local/etc/syslog-ng.conf.freenas
index 24f2ff5..90fa4c3 100644
--- a/src/freenas/usr/local/etc/syslog-ng.conf.freenas
+++ b/src/freenas/usr/local/etc/syslog-ng.conf.freenas
@@ -17,7 +17,7 @@ options { chain_hostnames(off); flush_lines(0); threaded(yes); };
#
source src { unix-dgram("/var/run/log");
unix-dgram("/var/run/logpriv" perm(0600));
- udp(); internal(); file("/dev/klog"); };
+ udp(localport(999)); internal(); file("/dev/klog"); };

#
# destinations
Jordan Hubbard
2014-10-21 03:53:01 UTC
Permalink
I cannot parse this at all. What?
Post by freenas-devel-PD4FTy7X32lNMZ+623a0Tti2O/
Working around what is presumably a bug in syslog-ng
due to which it cannot send on udp port 514
and all bsd syslog clients must have it been sent form
this priviledged port, so we change its local port binding
to a different port (here 999)
freenas-devel-PD4FTy7X32lNMZ+623a0Tti2O/
2014-10-21 03:21:22 UTC
Permalink
branch: master
Repository: freenas/freenas
Pushed by: git
Pushed to: branch master
commit 769dc13588fcbdc8d7468be1c67724ee2eb5c328
Author: Suraj Ravichandran <suraj-***@public.gmane.org>
Date: Mon Oct 20 14:23:17 2014 -0700

Adding syslog-ng to freenas (base) config yet to be done
---
build/nanobsd-cfg/os-ports | 1 +
1 file changed, 1 insertion(+)

diff --git a/build/nanobsd-cfg/os-ports b/build/nanobsd-cfg/os-ports
index 73d790b..d946030 100755
--- a/build/nanobsd-cfg/os-ports
+++ b/build/nanobsd-cfg/os-ports
@@ -145,6 +145,7 @@ add_port security/py-htpasswd
add_port www/apache24
add_port www/mod_mpm_itk
add_port devel/py-tabulate
+add_port sysutils/syslog-ng
add_port www/nginx WITH_OPENSSL_PORT=yes \
OPTIONS_FILE_SET+=HTTP_SSL \
OPTIONS_FILE_SET+=HTTP_UPLOAD \
freenas-devel-PD4FTy7X32lNMZ+623a0Tti2O/
2014-10-21 03:21:22 UTC
Permalink
branch: master
Repository: freenas/freenas
Pushed by: git
Pushed to: branch master
commit db2c1b4e9ff144c2d237d87124068e84e42432c8
Author: Suraj Ravichandran <suraj-***@public.gmane.org>
Date: Mon Oct 20 16:26:48 2014 -0700

Adding the freenas specific syslog-ng configuration file
---
src/freenas/usr/local/etc/syslog-ng.conf.freenas | 182 +++++++++++++++++++++++
1 file changed, 182 insertions(+)

diff --git a/src/freenas/usr/local/etc/syslog-ng.conf.freenas b/src/freenas/usr/local/etc/syslog-ng.conf.freenas
new file mode 100644
index 0000000..24f2ff5
--- /dev/null
+++ b/src/freenas/usr/local/etc/syslog-ng.conf.freenas
@@ -0,0 +1,182 @@
+@version:3.5
+
+#
+# This sample configuration file is essentially equilivent to the stock
+# FreeBSD /etc/syslog.conf file.
+#
+# $FreeBSD: head/sysutils/syslog-ng/files/syslog-ng.conf.sample 340872 2014-01-24 00:14:07Z mat $
+#
+
+#
+# options
+#
+options { chain_hostnames(off); flush_lines(0); threaded(yes); };
+
+#
+# sources
+#
+source src { unix-dgram("/var/run/log");
+ unix-dgram("/var/run/logpriv" perm(0600));
+ udp(); internal(); file("/dev/klog"); };
+
+#
+# destinations
+#
+destination messages { file("/var/log/messages"); };
+destination security { file("/var/log/security"); };
+destination authlog { file("/var/log/auth.log"); };
+destination maillog { file("/var/log/maillog"); };
+destination lpd-errs { file("/var/log/lpd-errs"); };
+destination xferlog { file("/var/log/xferlog"); };
+destination cron { file("/var/log/cron"); };
+destination debuglog { file("/var/log/debug.log"); };
+destination consolelog { file("/var/log/console.log"); };
+destination all { file("/var/log/all.log"); };
+destination newscrit { file("/var/log/news/news.crit"); };
+destination newserr { file("/var/log/news/news.err"); };
+destination newsnotice { file("/var/log/news/news.notice"); };
+destination slip { file("/var/log/slip.log"); };
+destination ppp { file("/var/log/ppp.log"); };
+destination console { file("/dev/console"); };
+destination allusers { usertty("*"); };
+#destination loghost { udp("loghost" port(514)); };
+
+#
+# log facility filters
+#
+filter f_auth { facility(auth); };
+filter f_authpriv { facility(authpriv); };
+filter f_not_authpriv { not facility(authpriv); };
+#filter f_console { facility(console); };
+filter f_cron { facility(cron); };
+filter f_daemon { facility(daemon); };
+filter f_ftp { facility(ftp); };
+filter f_kern { facility(kern); };
+filter f_lpr { facility(lpr); };
+filter f_mail { facility(mail); };
+filter f_news { facility(news); };
+filter f_security { facility(security); };
+filter f_user { facility(user); };
+filter f_uucp { facility(uucp); };
+filter f_local0 { facility(local0); };
+filter f_local1 { facility(local1); };
+filter f_local2 { facility(local2); };
+filter f_local3 { facility(local3); };
+filter f_local4 { facility(local4); };
+filter f_local5 { facility(local5); };
+filter f_local6 { facility(local6); };
+filter f_local7 { facility(local7); };
+
+#
+# log level filters
+#
+filter f_emerg { level(emerg); };
+filter f_alert { level(alert..emerg); };
+filter f_crit { level(crit..emerg); };
+filter f_err { level(err..emerg); };
+filter f_warning { level(warning..emerg); };
+filter f_notice { level(notice..emerg); };
+filter f_info { level(info..emerg); };
+filter f_debug { level(debug..emerg); };
+filter f_is_debug { level(debug); };
+
+#
+# program filters
+#
+filter f_ppp { program("ppp"); };
+filter f_slip { program("startslip"); };
+
+#
+# *.err;kern.warning;auth.notice;mail.crit /dev/console
+#
+log { source(src); filter(f_err); destination(console); };
+log { source(src); filter(f_kern); filter(f_warning); destination(console); };
+log { source(src); filter(f_auth); filter(f_notice); destination(console); };
+log { source(src); filter(f_mail); filter(f_crit); destination(console); };
+
+#
+# *.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
+#
+log { source(src); filter(f_notice); filter(f_not_authpriv); destination(messages); };
+log { source(src); filter(f_kern); filter(f_debug); destination(messages); };
+log { source(src); filter(f_lpr); filter(f_info); destination(messages); };
+log { source(src); filter(f_mail); filter(f_crit); destination(messages); };
+log { source(src); filter(f_news); filter(f_err); destination(messages); };
+
+#
+# security.* /var/log/security
+#
+log { source(src); filter(f_security); destination(security); };
+
+#
+# auth.info;authpriv.info /var/log/auth.log
+log { source(src); filter(f_auth); filter(f_info); destination(authlog); };
+log { source(src); filter(f_authpriv); filter(f_info); destination(authlog); };
+
+#
+# mail.info /var/log/maillog
+#
+log { source(src); filter(f_mail); filter(f_info); destination(maillog); };
+
+#
+# lpr.info /var/log/lpd-errs
+#
+log { source(src); filter(f_lpr); filter(f_info); destination(lpd-errs); };
+
+#
+# ftp.info /var/log/xferlog
+#
+# suraj edit : in freenas we have ftp.* instead of ftp.info so below is commented
+#log { source(src); filter(f_ftp); filter(f_info); destination(xferlog); };
+# suraj edit : and the below line is appropriate (i think)
+log { source(src); filter(f_ftp); destination(xferlog); };
+
+#
+# cron.* /var/log/cron
+#
+log { source(src); filter(f_cron); destination(cron); };
+
+#
+# *.=debug /var/log/debug.log
+#
+log { source(src); filter(f_is_debug); destination(debuglog); };
+
+#
+# *.emerg *
+#
+log { source(src); filter(f_emerg); destination(allusers); };
+
+#
+# uncomment this to log all writes to /dev/console to /var/log/console.log
+# console.info /var/log/console.log
+#
+#log { source(src); filter(f_console); filter(f_info); destination(consolelog); };
+
+#
+# uncomment this to enable logging of all log messages to /var/log/all.log
+# touch /var/log/all.log and chmod it to mode 600 before it will work
+# *.* /var/log/all.log
+#
+#log { source(src); destination(all); };
+
+#
+# uncomment this to enable logging to a remote loghost named loghost
+# *.* @loghost
+#
+#log { source(src); destination(loghost); };
+
+#
+# uncomment these if you're running inn
+# news.crit /var/log/news/news.crit
+# news.err /var/log/news/news.err
+# news.notice /var/log/news/news.notice
+#
+#log { source(src); filter(f_news); filter(f_crit); destination(newscrit); };
+#log { source(src); filter(f_news); filter(f_err); destination(newserr); };
+#log { source(src); filter(f_news); filter(f_notice); destination(newsnotice); };
+
+#
+# !ppp
+# *.* /var/log/ppp.log
+#
+log { source(src); filter(f_ppp); destination(ppp); };
Loading...