[Lunar-commits] <moonbase-other> rsyslog: created a sane config setup

Stefan Wold ratler at lunar-linux.org
Sun Dec 8 12:40:21 CET 2013


commit f4b8ad52a608777fe90abad67c07705730f12650
Author: Stefan Wold <ratler at lunar-linux.org>
Date: Sun, 08 Dec 2013 03:36:14 -0800
URL: https://github.com/lunar-linux/moonbase-other/commit/f4b8ad52a608777fe90abad67c07705730f12650

rsyslog: created a sane config setup
---
  utils/rsyslog/20-default.conf           | +55/-0    
  utils/rsyslog/BUILD                     | +4/-5     
  utils/rsyslog/DEPENDS                   | +3/-3     
  utils/rsyslog/logrotate.d/rsyslog       | +3/-2     
  utils/rsyslog/rsyslog.conf              | +18/-0    
  utils/rsyslog/systemd.d/rsyslog.service | +7/-4     
  6 files changed, 90 insertions(+), 14 deletions(-)

--- /dev/null
+++ b/utils/rsyslog/20-default.conf
@@ -0,0 +1,55 @@
+# Default rules for rsyslog
+
+auth,authpriv.*                 /var/log/auth.log
+*.*;auth,authpriv.none          -/var/log/syslog
+cron.*                          /var/log/cron.log
+#daemon.*                       -/var/log/daemon.log
+kern.*                          -/var/log/kern.log
+#lpr.*                          -/var/log/lpr.log
+mail.*                          -/var/log/mail.log
+#user.*                         -/var/log/user.log
+
+#
+# Logging for the mail system.  Split it up so that
+# it is easy to write scripts to parse these files.
+#
+#mail.info                      -/var/log/mail.info
+#mail.warn                      -/var/log/mail.warn
+mail.err                        /var/log/mail.err
+
+#
+# Logging for INN news system.
+#
+news.crit                       /var/log/news/news.crit
+news.err                        /var/log/news/news.err
+news.notice                     -/var/log/news/news.notice
+
+#
+# catch-all log files.
+#
+*.=debug;\
+        auth,authpriv.none;\
+        news.none;mail.none           -/var/log/debug
+*.=info;*.=notice;*.=warn;\
+        auth,authpriv.none;\
+        cron,daemon.none;\
+        mail,news.none                -/var/log/messages
+
+#
+# Emergencies are sent to everybody logged in.
+#
+*.emerg                                :omusrmsg:*
+
+
+# The named pipe /dev/xconsole is for the `xconsole' utility.  To use it,
+# you must invoke `xconsole' with the `-file' option:
+# 
+#    $ xconsole -file /dev/xconsole [...]
+#
+# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
+#      busy site..
+#
+daemon.*;mail.*;\
+        news.err;\
+        *.=debug;*.=info;\
+        *.=notice;*.=warn       |/dev/xconsole
--- a/utils/rsyslog/BUILD
+++ b/utils/rsyslog/BUILD
@@ -19,16 +19,15 @@
   default_build  &&
 
   if [ ! -f /etc/rsyslog.conf ]; then
-     install -m 644 rsyslog.conf /etc/rsyslog.conf
+     install -m 644 $SCRIPT_DIRECTORY/rsyslog.conf /etc/rsyslog.conf
+  fi &&
+  if [ ! -d /etc/rsyslog.d/20-default.conf ]; then
+    install -Dm0644 $SCRIPT_DIRECTORY/20-default.conf /etc/rsyslog.d/20-default.conf
   fi &&
-
   mkdir -p /usr/share/doc/rsyslog/scripts/{mysql,pqsql} &&
   install -m 644 plugins/ommysql/createDB.sql /usr/share/doc/rsyslog/scripts/mysql/ &&
   install -m 644 plugins/ompgsql/createDB.sql /usr/share/doc/rsyslog/scripts/pqsql/ &&
 
-  rm -f /usr/lib/systemd/system/syslog.service
-  ln -sf /usr/lib/systemd/system/rsyslog.service /usr/lib/systemd/system/syslog.service  &&
-
   gather_docs doc/rsyslog-example.conf
 
 ) > $C_FIFO 2>&1
--- a/utils/rsyslog/DEPENDS
+++ b/utils/rsyslog/DEPENDS
@@ -1,11 +1,12 @@
-depends  libee
+depends libee
+depends libestr
 
 optional_depends zlib              \
                  "--enable-zlib"   \
                  "--disable-zlib"  \
                  "for zlib compression support"
 
-optional_depends mysql              \
+optional_depends %MYSQL             \
                  "--enable-mysql"   \
                  "--disable-mysql"  \
                  "for MySQL support"
@@ -41,4 +42,3 @@ optional_depends gnutls             \
                  "for GnuTLS support"
 
 optional_depends logrotate "" "" "for log rotation support"
-optional_depends systemd   "" "" "for systemd support"
--- a/utils/rsyslog/logrotate.d/rsyslog
+++ b/utils/rsyslog/logrotate.d/rsyslog
@@ -1,6 +1,7 @@
-/var/log/messages /var/log/auth /var/log/mail /var/log/spooler /var/log/boot.log /var/log/cron /var/log/kernel /var/log/lpr {
+/var/log/messages /var/log/syslog /var/log/auth.log /var/log/mail.log /var/log/mail.err /var/log/cron.log /var/log/kern.log /var/log/debug /var/log/news {
+    missingok
     sharedscripts
     postrotate
-        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+        /usr/bin/killall -HUP /usr/sbin/rsyslogd
     endscript
 }
--- /dev/null
+++ b/utils/rsyslog/rsyslog.conf
@@ -0,0 +1,18 @@
+# Basic config
+
+$ModLoad imuxsock # provides support for local system logging
+$ModLoad imklog   # provides kernel logging support
+
+$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+
+$RepeatedMsgReduction on
+
+$FileOwner root
+$FileGroup root
+$FileCreateMode 0640
+$DirCreateMode 0755
+$Umask 0022
+
+$WorkDirectory /var/spool/rsyslog
+
+$IncludeConfig /etc/rsyslog.d/*.conf
--- a/utils/rsyslog/systemd.d/rsyslog.service
+++ b/utils/rsyslog/systemd.d/rsyslog.service
@@ -1,9 +1,12 @@
 [Unit]
-Description=Syslog daemon
+Description=System Logging Service
+Requires=syslog.socket
 
 [Service]
-ExecStart=/usr/sbin/rsyslogd -c4 -n
-Restart=always
+Type=notify
+ExecStart=/usr/sbin/rsyslogd -n
+StandardOutput=null
 
 [Install]
-WantedBy=syslog.target
+WantedBy=multi-user.target
+Alias=syslog.service




More information about the Lunar-commits mailing list