From f3a5f1cbfcc685d03c859e597cf19260868e2498 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 1 Feb 2023 17:46:22 -0500
Subject: rsyslog: initial inclusion

---
 linhes/rsyslog/PKGBUILD          | 57 ++++++++++++++++++++++++++++++++++++++++
 linhes/rsyslog/__changelog       |  1 +
 linhes/rsyslog/rsyslog.conf      | 54 +++++++++++++++++++++++++++++++++++++
 linhes/rsyslog/rsyslog.install   |  5 ++++
 linhes/rsyslog/rsyslog.logrotate |  7 +++++
 linhes/rsyslog/rsyslog.service   | 16 +++++++++++
 6 files changed, 140 insertions(+)
 create mode 100644 linhes/rsyslog/PKGBUILD
 create mode 100644 linhes/rsyslog/__changelog
 create mode 100644 linhes/rsyslog/rsyslog.conf
 create mode 100644 linhes/rsyslog/rsyslog.install
 create mode 100644 linhes/rsyslog/rsyslog.logrotate
 create mode 100644 linhes/rsyslog/rsyslog.service

diff --git a/linhes/rsyslog/PKGBUILD b/linhes/rsyslog/PKGBUILD
new file mode 100644
index 0000000..567df1d
--- /dev/null
+++ b/linhes/rsyslog/PKGBUILD
@@ -0,0 +1,57 @@
+pkgname=rsyslog
+pkgver=8.2212.0
+pkgrel=1
+pkgdesc="An enhanced multi-threaded syslogd with a focus on security and reliability"
+url="http://www.rsyslog.com/"
+arch=('x86_64' 'i686' 'aarch64')
+license=('GPL3')
+depends=('libestr' 'liblogging' 'librelp' 'libfastjson')
+makedepends=('postgresql-libs>=8.4.1' 'libmariadbclient' 'net-snmp' 'gnutls'
+	     'python-docutils' 'libestr' 'liblogging' 'librelp' 'libfastjson' 'bison' 'flex')
+optdepends=('postgresql-libs: PostgreSQL Database Support'
+	    'libmariadbclient: MySQL Database Support'
+	    'net-snmp'
+	    'gnutls')
+backup=('etc/rsyslog.conf'
+	'etc/logrotate.d/rsyslog')
+options=('strip' 'zipman')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/rsyslog/rsyslog/archive/v${pkgver}.tar.gz"
+	'rsyslog.logrotate'
+	'rsyslog.conf'
+        'rsyslog.service')
+
+sha256sums=('4b5f2205e91adf5e5821de8957a42b937505607f663c71ee381aca0011ea8e42'
+            '0f5bea3fd4dff2c9f097bf95768b2e1f6e9cfd9a08eab98bc3b3b4d2ed44119a'
+            '0a28fcc346cd47e8142cdbb5df7503277f624b59a9ec783adb1581d65e92b041'
+            '81b9f9b78395405b679849143a6709911d00e9317928fdb2a2540f52965847c2')
+install=$pkgname.install
+
+build() {
+  cd "$srcdir"/${pkgname}-${pkgver}
+  ./autogen.sh --prefix=/usr \
+               --sbindir=/usr/bin \
+               --enable-mysql \
+               --enable-pgsql \
+               --enable-mail \
+               --enable-imfile \
+               --enable-snmp \
+               --enable-gnutls \
+               --enable-inet \
+               --enable-imjournal \
+               --enable-omjournal \
+               --enable-relp \
+               --enable-impstats \
+               --enable-imptcp \
+               --enable-omprog \
+               --with-systemdsystemunitdir=/usr/lib/systemd/system
+
+  make
+}
+
+package() {
+  cd "$srcdir"/${pkgname}-${pkgver}
+  make install DESTDIR="$pkgdir"
+  install -D -m644 "$srcdir"/${pkgname}.conf "$pkgdir"/etc/${pkgname}.conf
+  install -D -m644 "$srcdir"/${pkgname}.logrotate "$pkgdir"/etc/logrotate.d/${pkgname}
+  install -D -m644 "$srcdir"/${pkgname}.service "$pkgdir"/usr/lib/systemd/system/${pkgname}.service
+}
diff --git a/linhes/rsyslog/__changelog b/linhes/rsyslog/__changelog
new file mode 100644
index 0000000..d3dac2e
--- /dev/null
+++ b/linhes/rsyslog/__changelog
@@ -0,0 +1 @@
+rsyslog.conf: LH modifications
diff --git a/linhes/rsyslog/rsyslog.conf b/linhes/rsyslog/rsyslog.conf
new file mode 100644
index 0000000..843bdd4
--- /dev/null
+++ b/linhes/rsyslog/rsyslog.conf
@@ -0,0 +1,54 @@
+# Minimal config
+
+$ModLoad imuxsock # provides support for local system logging
+$ModLoad imklog   # provides kernel logging support
+$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+$FileOwner root
+$FileGroup root
+$FileCreateMode 0640
+$DirCreateMode 0755
+$Umask 0022
+$WorkDirectory /var/spool/rsyslog
+$IncludeConfig /etc/rsyslog.d/*.conf
+
+
+$template DailyPerHostLogs,"/var/log/%HOSTNAME%_messages.log"
+$template DynFile,"/var/log/%HOSTNAME%_%programname%.log"
+$template DynMail,"/var/log/%HOSTNAME%_maillog.log"
+$template DynCron,"/var/log/%HOSTNAME%_cron.log"
+$template DynBoot,"/var/log/%HOSTNAME%_boot.log"
+$template DynSpooler,"/var/log/%HOSTNAME%_spooler.log"
+$template DynLighttpd,"/var/log/%HOSTNAME%_lighttpd.log"
+
+if $programname contains 'lighttpd' then ?DynLighttpd
+& stop
+
+
+# Log anything (except mail) of level info or higher.
+# Don't log private authentication messages!
+#*.info;mail.none;authpriv.none;cron.none                -/var/log/messages
+*.info;mail.none;authpriv.none;cron.none;local6.none                -?DailyPerHostLogs
+*.info;mail.none;authpriv.none;cron.none;local6.none                -?DynFile
+
+# The authpriv file has restricted access.
+#authpriv.*                                              /var/log/secure
+authpriv.*                                              ?DynFile
+
+# Log all the mail messages in one place.
+#mail.*                                                  -/var/log/maillog
+mail.*                                                  ?DynMail
+
+# Log cron stuff
+#cron.*                                                  -/var/log/cron
+cron.*                                                  ?DynCron
+
+# Everybody gets emergency messages
+*.emerg                                                 :omusrmsg:*
+
+# Save news errors of level crit and higher in a special file.
+#uucp,news.crit                                          -/var/log/spooler
+uucp,news.crit                                          -?DynSpooler
+
+# Save boot messages also to boot.log
+#local7.*                                                /var/log/boot.log
+local7.*                                                ?DynBoot
diff --git a/linhes/rsyslog/rsyslog.install b/linhes/rsyslog/rsyslog.install
new file mode 100644
index 0000000..73a699d
--- /dev/null
+++ b/linhes/rsyslog/rsyslog.install
@@ -0,0 +1,5 @@
+post_install() {
+    echo
+    echo "    Create /var/spool/rsyslog directory before starting rsyslog"
+    echo
+}
diff --git a/linhes/rsyslog/rsyslog.logrotate b/linhes/rsyslog/rsyslog.logrotate
new file mode 100644
index 0000000..889c989
--- /dev/null
+++ b/linhes/rsyslog/rsyslog.logrotate
@@ -0,0 +1,7 @@
+/var/log/auth.log /var/log/cron.log /var/log/daemon.log /var/log/debug /var/log/kern.log /var/log/lpr.log /var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn /var/log/messages /var/log/news /var/log/syslog /var/log/user.log {
+    missingok
+    sharedscripts
+    postrotate
+	/usr/bin/killall -HUP /usr/bin/rsyslogd
+    endscript
+}
diff --git a/linhes/rsyslog/rsyslog.service b/linhes/rsyslog/rsyslog.service
new file mode 100644
index 0000000..0f3301e
--- /dev/null
+++ b/linhes/rsyslog/rsyslog.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=System Logging Service
+Requires=syslog.socket
+Documentation=man:rsyslogd(8)
+Documentation=http://www.rsyslog.com/doc/
+
+[Service]
+Type=notify
+PIDFile=/run/rsyslogd.pid
+ExecStart=/usr/bin/rsyslogd -n -i /run/rsyslogd.pid
+StandardOutput=null
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+Alias=syslog.service
-- 
cgit v0.12

