git: 2a74583ea36b - main - sysutils/rsyslog8: update pkg-message and add sample config file

From: Matthew Seaman <matthew_at_FreeBSD.org>
Date: Fri, 03 Dec 2021 18:14:32 UTC
The branch main has been updated by matthew:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2a74583ea36bedf5f56c4cffcaa88ad317679104

commit 2a74583ea36bedf5f56c4cffcaa88ad317679104
Author:     Matthew Seaman <matthew@FreeBSD.org>
AuthorDate: 2021-12-03 18:10:10 +0000
Commit:     Matthew Seaman <matthew@FreeBSD.org>
CommitDate: 2021-12-03 18:14:18 +0000

    sysutils/rsyslog8: update pkg-message and add sample config file
    
    Upstream changes mean that the advice formerly given in pkg-message to
    modify the default /etc/syslog.conf file as the basis of a new
    ${PREFIX}/etc/rsyslog.conf are now less useful and confusing to end
    users.
    
    Therefore, update the pkg-message accordingly, and install a sample
    config file which should duplicated the functionality of the base
    syslog.conf.
    
    PR:             260158
    Reported by:    Mark Johnston
---
 sysutils/rsyslog8/Makefile             |  5 ++++
 sysutils/rsyslog8/files/pkg-message.in | 19 +++++---------
 sysutils/rsyslog8/files/rsyslog.conf   | 47 ++++++++++++++++++++++++++++++++++
 sysutils/rsyslog8/pkg-plist            |  2 ++
 4 files changed, 61 insertions(+), 12 deletions(-)

diff --git a/sysutils/rsyslog8/Makefile b/sysutils/rsyslog8/Makefile
index 0bfd895b2a9a..e39a8c31eba2 100644
--- a/sysutils/rsyslog8/Makefile
+++ b/sysutils/rsyslog8/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	rsyslog
 PORTVERSION=	8.2110.0
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www.rsyslog.com/files/download/rsyslog/
 
@@ -152,6 +153,10 @@ post-patch:
 	@${REINPLACE_CMD} -e 's,/lib/rsyslog,${PREFIX}/lib/rsyslog,' ${WRKSRC}/tools/syslogd.c
 	@${FIND} ${WRKSRC} -name '*.bak' -delete
 
+post-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/rsyslog.d
+	${INSTALL_DATA} ${FILESDIR}/rsyslog.conf ${STAGEDIR}${PREFIX}/etc/rsyslog.conf.sample
+
 post-install-DOCS-on:
 .for SQL in ${PORTDOCS:M*.sql}
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}/${SQL:H}
diff --git a/sysutils/rsyslog8/files/pkg-message.in b/sysutils/rsyslog8/files/pkg-message.in
index 87e6076dbf4e..c9dacc98a087 100644
--- a/sysutils/rsyslog8/files/pkg-message.in
+++ b/sysutils/rsyslog8/files/pkg-message.in
@@ -1,24 +1,19 @@
 [
 { type: install
   message: <<EOM
-To start using rsyslogd(8), stop syslogd(8) if it's running and
+To start using rsyslogd(8), stop syslogd(8) if it is running and
 add the following lines to rc.conf(5):
 
   syslogd_enable="NO"
   rsyslogd_enable="YES"
 
-It's recommended to copy syslog.conf(5) to
-%%PREFIX%%/etc/rsyslog.conf and edit it there. Otherwise add
-this:
+For best results, create a new configuration file
+%%PREFIX%%/etc/rsyslog.conf rather than trying to re-use the original
+/etc/syslog.conf -- the configuration file syntax has diverged over
+time, and it's no longer anywhere near compatible.
 
-  rsyslogd_config="/etc/syslog.conf"
-
-Add the following (3) lines to the beginning of the config file, for
-basic functionality:
-
-  module(load="immark")   # provides --MARK-- message capability
-  module(load="imuxsock") # provides support for local system logging
-  module(load="imklog")   # kernel logging
+The port will install an example configuration file which should
+provide the same logging setup as the default /etc/syslog.conf
 
 newsyslog(8) has the path of syslogd's pid file hardcoded. To
 make it work seamlessly with rsyslog, add this:
diff --git a/sysutils/rsyslog8/files/rsyslog.conf b/sysutils/rsyslog8/files/rsyslog.conf
new file mode 100644
index 000000000000..6072e7182723
--- /dev/null
+++ b/sysutils/rsyslog8/files/rsyslog.conf
@@ -0,0 +1,47 @@
+
+# Consult the rsyslog.conf(5) manpage, and the comprehensive on-line
+# documentation at
+# https://www.rsyslog.com/doc/v8-stable/configuration/index.html
+#
+# Derived from
+# https://cgit.freebsd.org/src/tree/usr.sbin/syslogd/syslog.conf
+
+module(load="immark")   # provides --MARK-- message capability
+module(load="imuxsock") # provides support for local system logging
+module(load="imklog")   # kernel logging
+
+*.err;kern.warning;auth.notice;mail.crit		/dev/console
+*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err	/var/log/messages
+security.*			/var/log/security
+auth.info;authpriv.info		/var/log/auth.log
+mail.info			/var/log/maillog
+cron.*				/var/log/cron
+
+if $programname != "devd" then {
+   *.=debug			/var/log/debug.log
+   *.emerg			action(type="omusrmsg" users="*")
+   daemon.info			/var/log/daemon.log
+}
+
+# uncomment this to log all writes to /dev/console to /var/log/console.log
+# touch /var/log/console.log and chmod it to mode 600 before it will work
+#console.info			/var/log/console.log
+
+# 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
+
+# uncomment this to enable logging to a remote loghost named loghost
+#*.*				@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
+
+# Uncomment this if you wish to see messages produced by devd
+# if $programname == "devd" then {
+#    *.>=notice			/var/log/devd.log
+# }
+
+include(file="/usr/local/etc/rsyslog.d/*.conf" mode="optional")
diff --git a/sysutils/rsyslog8/pkg-plist b/sysutils/rsyslog8/pkg-plist
index 3546b22d7add..7f512c039c16 100644
--- a/sysutils/rsyslog8/pkg-plist
+++ b/sysutils/rsyslog8/pkg-plist
@@ -1,3 +1,5 @@
+@dir etc/rsyslog.d
+@sample etc/rsyslog.conf.sample
 lib/rsyslog/fmhash.so
 lib/rsyslog/fmhttp.so
 lib/rsyslog/im3195.so