aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslog-ng
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2019-01-26 21:54:17 +0100
committerJakub Jirutka <jakub@jirutka.cz>2019-01-26 23:20:28 +0100
commita0b129e51bb92d043d5b0b9f1c0d6def56ded541 (patch)
treeb1ab1c77763b7dcbb16344e00e9a0a5302b17c85 /main/syslog-ng
parent699fb7fcf40788d816f7c68604cac7c39134c550 (diff)
downloadaports-a0b129e51bb92d043d5b0b9f1c0d6def56ded541.tar.gz
aports-a0b129e51bb92d043d5b0b9f1c0d6def56ded541.tar.bz2
aports-a0b129e51bb92d043d5b0b9f1c0d6def56ded541.tar.xz
main/syslog-ng: replace weirdly modularized configs with single file
Building syslog-ng configuration from multiple fragment files using a shell script is unnecessary complicated and error prone - syslog-ng supports the include directive. This change is not backward compatible, but I quite doubt that anyone was using this. The new config is based on the default config for RedHat from upstream.
Diffstat (limited to 'main/syslog-ng')
-rw-r--r--main/syslog-ng/APKBUILD46
-rw-r--r--main/syslog-ng/syslog-ng-destination.std22
-rw-r--r--main/syslog-ng/syslog-ng-filter.std34
-rw-r--r--main/syslog-ng/syslog-ng-log.std56
-rw-r--r--main/syslog-ng/syslog-ng-options.std37
-rw-r--r--main/syslog-ng/syslog-ng-plugins.std6
-rw-r--r--main/syslog-ng/syslog-ng-source.std12
-rw-r--r--main/syslog-ng/syslog-ng.conf120
-rwxr-xr-xmain/syslog-ng/syslog-ng.initd43
-rw-r--r--main/syslog-ng/syslog-ng.logrotate52
-rw-r--r--main/syslog-ng/syslog-ng.post-upgrade4
11 files changed, 155 insertions, 277 deletions
diff --git a/main/syslog-ng/APKBUILD b/main/syslog-ng/APKBUILD
index ad97d0399f..7ef7c441ba 100644
--- a/main/syslog-ng/APKBUILD
+++ b/main/syslog-ng/APKBUILD
@@ -33,14 +33,9 @@ subpackages="
$pkgname-python2:_python2
"
source="https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$pkgver/syslog-ng-$pkgver.tar.gz
- syslog-ng.logrotate
- syslog-ng.initd
- syslog-ng-destination.std
- syslog-ng-filter.std
- syslog-ng-log.std
- syslog-ng-options.std
- syslog-ng-plugins.std
- syslog-ng-source.std
+ $pkgname.conf
+ $pkgname.logrotate
+ $pkgname.initd
"
builddir="$srcdir/$pkgname-$pkgver"
@@ -113,21 +108,21 @@ package() {
cd "$builddir"
make -j1 DESTDIR="$pkgdir" install
- rm -rf "$pkgdir"/etc/syslog-ng
- rm -rf "$pkgdir"/run
- rm -rf "$pkgdir"/usr/lib/$pkgname/libtest
+
+ cd "$pkgdir"
+
+ rm -rf run usr/lib/$pkgname/libtest
+
# getent module doesn't build properly as musl doesn't support reentrant
# getprotoby[number|name] funcs. The provided compat lib only patches
# solaris, which does provide reentrant versions under a different sig
- rm -f "$pkgdir"/usr/lib/$pkgname/libtfgetent.so
- install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
- install -D -m644 "$srcdir"/syslog-ng-destination.std "$pkgdir"/etc/syslog-ng/syslog-ng-destination.std
- install -D -m644 "$srcdir"/syslog-ng-filter.std "$pkgdir"/etc/syslog-ng/syslog-ng-filter.std
- install -D -m644 "$srcdir"/syslog-ng-log.std "$pkgdir"/etc/syslog-ng/syslog-ng-log.std
- install -D -m644 "$srcdir"/syslog-ng-options.std "$pkgdir"/etc/syslog-ng/syslog-ng-options.std
- install -D -m644 "$srcdir"/syslog-ng-plugins.std "$pkgdir"/etc/syslog-ng/syslog-ng-plugins.std
- install -D -m644 "$srcdir"/syslog-ng-source.std "$pkgdir"/etc/syslog-ng/syslog-ng-source.std
- install -D -m644 "$srcdir"/syslog-ng.logrotate "$pkgdir"/etc/logrotate.d/syslog-ng
+ rm -f usr/lib/$pkgname/libtfgetent.so
+
+ install -m 644 "$srcdir"/$pkgname.conf etc/$pkgname/$pkgname.conf
+ install -D -m 755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname
+ install -D -m 644 "$srcdir"/$pkgname.logrotate etc/logrotate.d/$pkgname
+
+ install -d -m 755 etc/$pkgname/conf.d
}
scl() {
@@ -169,11 +164,6 @@ _submv() {
}
sha512sums="2e6ea690f8762f3f37885118f023048c4cba59f58002c87fa1c469cb991b2ba707015b3e54c50f17c3d6e6251d798557406925a9159f4fa914331f281dc39e48 syslog-ng-3.18.1.tar.gz
-a062d1601f5215f60e2fc40c6ca498d768aa97af3647a9468731123a28fdd67962421b4412bfbe08a1123141b730cb78f102230ab72befec05ba7f398b39e27a syslog-ng.logrotate
-84fa9b10268edd8cae2ed1fd4b0d8b7078afab050571e1f05ce45c95f97a650511e8dfe30f5815cf2582446ea9f4a45aafcde3a5ae373716cecb6395bc1dd16b syslog-ng.initd
-b51d8b3da9584b6cb5b5c023b5ca1085d8e4c2cfa56f6ed12fe6feb0f33a390b43825aaaf4dd74eb6b7765485fe42f7f21c74380b72de9ed2c7775787ab1e720 syslog-ng-destination.std
-e04a70a0b8fc4f40951c9b608b0dede1fa561dd7f58ce8fd8bac70b578b749d15d202973fd9de9fe494656ee138ef5efd32ea6229e6ec0a2f19672dd621acc91 syslog-ng-filter.std
-d7864f6666101e0818dd0178a4d1ada2417280de153ff916fe4879348a37b7bfab5936e86629dc52e4edf82fbd601e04d08ed5a2117bcb0470a3d5884add9f55 syslog-ng-log.std
-9f4224faf45c73daa54549aebf20e2c45d0bf533a20d2ad97d7258490ce793c8b08cc34cac2a89d185e936515096eb93c793018986c8d21861d88c4b0005d16a syslog-ng-options.std
-6da6629cad9a1d8a54139cda968ca6a4b86536b2c14eb9bc8a3d09c7cbc20cf18fadee0046687de30149ea18da65a7f8ba08c07b35fb46eb42e1fc5faecff3e7 syslog-ng-plugins.std
-b441689ded539a358bf03fc292721a280ea29e1592b2a10ce011b455643dae3949af239a0f2bf84957096757e55a87e844df10c0be016fb7ac969d53def6afc6 syslog-ng-source.std"
+556726815bd032a44623b809e3b9b92920eb115ae1626cdd0b1d7c6772c1464f2364bbe5a39b5d1ceebdca63b270aa10b402f615f820a44f85a7a2bbd5631448 syslog-ng.conf
+1825b85fb584c5cecf0ad370e81a7473b5c973ce10adce386d1ba5f68432abe4e2f54c937d7d94edb22dbd9031eff483bd113bc3244ce0d0072cf4bf4ab5c2cc syslog-ng.logrotate
+9caac269ed561cfe5b3a0b4e443037e7c9105bf22b2e7830916d1a8baf62682566ee1f8ed96fe62f1755903fb7b8caf406aaa151d49213a7eff62d6d3ce0c87c syslog-ng.initd"
diff --git a/main/syslog-ng/syslog-ng-destination.std b/main/syslog-ng/syslog-ng-destination.std
deleted file mode 100644
index 93bc3030af..0000000000
--- a/main/syslog-ng/syslog-ng-destination.std
+++ /dev/null
@@ -1,22 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng standard log files; Do not edit this file!
-# append log file entry with line on a file: syslog-ng-destination.<package>
-# ---------------------------------------------------------------------------------
- destination df_auth { file("/var/log/auth.log"); };
- destination df_kern { file("/var/log/kern.log"); };
- destination df_mail { file("/var/log/mail.log"); };
- destination df_error { file("/var/log/error.log"); };
-# these files are meant for the mail system log files
-# and provide re-usable destinations for {mail,cron,...}.info,
-# {mail,cron,...}.notice, etc.
- destination df_facility_dot_info { file("/var/log/$FACILITY.info"); };
- destination df_facility_dot_notice { file("/var/log/$FACILITY.notice"); };
- destination df_facility_dot_warn { file("/var/log/$FACILITY.warn"); };
- destination df_facility_dot_err { file("/var/log/$FACILITY.err"); };
- destination df_facility_dot_crit { file("/var/log/$FACILITY.crit"); };
-# some more classical and useful files found in standard syslog configurations
- destination df_debug { file("/var/log/debug"); };
- destination df_messages { file("/var/log/messages"); };
-# consoles
-# this will send messages to everyone logged in
- destination du_all { usertty("*"); };
diff --git a/main/syslog-ng/syslog-ng-filter.std b/main/syslog-ng/syslog-ng-filter.std
deleted file mode 100644
index 29251f7598..0000000000
--- a/main/syslog-ng/syslog-ng-filter.std
+++ /dev/null
@@ -1,34 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng standard filters; Do not edit this file!
-# append filter entry with line on a file: syslog-ng-filter.<package>
-# ---------------------------------------------------------------------------------
-# all messages from the auth and authpriv facilities
- filter f_auth { facility(auth,authpriv); };
-# respectively: messages from the cron, daemon, kern, lpr, mail, news, user,
-# and uucp facilities
- filter f_cron { facility(cron); };
- filter f_daemon { facility(daemon); };
- filter f_kern { facility(kern); };
- filter f_lpr { facility(lpr); };
- filter f_mail { facility(mail); };
- filter f_news { facility(news); };
- filter f_user { facility(user); };
- filter f_uucp { facility(uucp); };
- filter f_ftp { facility(ftp); };
-# some filters to select messages of priority greater or equal to info, warn,
-# and err (equivalents of syslogd's *.info, *.warn, and *.err)
- filter f_at_least_info { level(info..emerg); };
- filter f_at_least_notice { level(notice..emerg); };
- filter f_at_least_warn { level(warn..emerg); };
- filter f_at_least_err { level(err..emerg); };
- filter f_at_least_crit { level(crit..emerg); };
-# all messages of priority debug not coming from the auth, authpriv, news, and
-# mail facilities
- filter f_debug { level(debug) and not facility(auth,authpriv,kern,mail); };
-# all messages of info, notice, or warn priority not coming form the auth, authpriv,
-# kern and mail facilities
- filter f_messages { level(info,notice,warn) and not facility(auth,authpriv,kern,mail,ftp); };
-# messages with priority emerg
- filter f_emerg { level(emerg); };
-# mysql syslog write all messages to err level
- filter f_err_no_mysqld { level(err..emerg) and not program(mysqld); };
diff --git a/main/syslog-ng/syslog-ng-log.std b/main/syslog-ng/syslog-ng-log.std
deleted file mode 100644
index a8cc402b1a..0000000000
--- a/main/syslog-ng/syslog-ng-log.std
+++ /dev/null
@@ -1,56 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng logs; Do not edit this file!
-# append log with line on a file: syslog-ng-log.<package>
-# ---------------------------------------------------------------------------------
-# order matters if you use "flags(final);" to mark the end of processing in a
-# "log" statement
-# these rules provide the same behavior as the commented original syslogd rules
-
-# auth,authpriv.* /var/log/auth.log
-log {
- source(s_all);
- filter(f_auth);
- destination(df_auth);
-};
-
-# kern.* -/var/log/kern.log
-log {
- source(s_all);
- filter(f_kern);
- destination(df_kern);
-};
-
-# mail.* -/var/log/mail.log
-log {
- source(s_all);
- filter(f_mail);
- destination(df_mail);
-};
-# *.=debug;
-# auth,authpriv.none;\
-# news.none;mail.none -/var/log/debug
-log {
- source(s_all);
- filter(f_debug);
- destination(df_debug);
-};
-# *.=info;*.=notice;*.=warn;\
-# auth,authpriv.none;\
-# mail,news.none -/var/log/messages
-log {
- source(s_all);
- filter(f_messages);
- destination(df_messages);
-};
-# error ... emergency /var/log/error.log
-log {
- source(s_all);
- filter(f_err_no_mysqld);
- destination(df_error);
-};
-# *.emerg *
-log {
- source(s_all);
- filter(f_emerg);
- destination(du_all);
-};
diff --git a/main/syslog-ng/syslog-ng-options.std b/main/syslog-ng/syslog-ng-options.std
deleted file mode 100644
index 6e9fe75e56..0000000000
--- a/main/syslog-ng/syslog-ng-options.std
+++ /dev/null
@@ -1,37 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng standard options; Do not edit this file!
-# Append entry with line on a file: syslog-ng-options.<package>
-# ---------------------------------------------------------------------------------
-# disable the chained hostname format in logs
-# (default is enabled)
- chain_hostnames(0);
-# the time to wait before a died connection is re-established (default is 60)
- time_reopen(10);
-# the time to wait before an idle destination file is closed (default is 60)
- time_reap(360);
-# the number of lines buffered before written to file you might want to
-# increase this if your disk isn't catching with all the log messages you get
-# or if you want less disk activity (say on a laptop) (default is 0)
-#sync(0);
-# the number of lines fitting in the output queue
- log_fifo_size(2048);
-# enable or disable directory creation for destination files
- create_dirs(yes);
-# default owner, group, and permissions for log files (defaults are 0, 0, 0600)
-#owner(root);
- group(adm);
- perm(0640);
-# default owner, group, and permissions for created directories (defaults are 0, 0, 0700)
-#dir_owner(root);
-#dir_group(root);
- dir_perm(0755);
-# enable or disable DNS. Usage syslog-ng blocks on DNS queries, so enabling DNS
-# may lead to a Denial of Service attack (default is yes)
- use_dns(no);
-# maximum length of message in bytes. This is only limited by the program
-# listening on the /dev/log Unix socket, glibc can handle arbitrary length
-# log messages, but -- for example -- syslogd accepts only 1024 bytes
-# (default is 2048)
-#log_msg_size(2048);
-# Disable statistic log messages.
- stats_freq(0);
diff --git a/main/syslog-ng/syslog-ng-plugins.std b/main/syslog-ng/syslog-ng-plugins.std
deleted file mode 100644
index 9e4c952ca8..0000000000
--- a/main/syslog-ng/syslog-ng-plugins.std
+++ /dev/null
@@ -1,6 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng plugins; Do not edit this file!
-# append source with line on a file: syslog-ng-plugins.<package>
-# ---------------------------------------------------------------------------------
-# version
-@version: 3.13
diff --git a/main/syslog-ng/syslog-ng-source.std b/main/syslog-ng/syslog-ng-source.std
deleted file mode 100644
index 33b5d83e68..0000000000
--- a/main/syslog-ng/syslog-ng-source.std
+++ /dev/null
@@ -1,12 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng sources; Do not edit this file!
-# append source with line on a file: syslog-ng-source.<package>
-# ---------------------------------------------------------------------------------
-source s_all {
-# message generated by Syslog-NG
- internal();
-# standard Linux log source (this is the default place for the syslog() function to send logs to)
- unix-dgram("/dev/log");
-# messages from the kernel
- file("/proc/kmsg" program_override("kernel"));
-};
diff --git a/main/syslog-ng/syslog-ng.conf b/main/syslog-ng/syslog-ng.conf
new file mode 100644
index 0000000000..4ee61e9b5c
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.conf
@@ -0,0 +1,120 @@
+@version:3.18
+@include "scl.conf"
+
+# syslog-ng configuration file.
+#
+# See syslog-ng(8) and syslog-ng.conf(5) for more information.
+#
+# Note: It also sources additional configuration files (*.conf)
+# located in /etc/syslog-ng/conf.d/.
+
+#
+# Options
+#
+options {
+ # Create destination directories if missing.
+ create_dirs(yes);
+
+ # The default action of syslog-ng is to log a MARK line to the file every
+ # 20 minutes. That's seems high for most people so turn it down to once an
+ # hour. Set it to zero if you don't want the functionality at all.
+ mark_freq(3600);
+
+ # The default action of syslog-ng is to log a STATS line to the file every
+ # 10 minutes. That's pretty ugly after a while. Change it to every 12 hours
+ # so you get a nice daily update of how many messages syslog-ng missed (0).
+ stats_freq(43200);
+
+ # Time to wait before a died connection is re-established (default is 60).
+ time_reopen(5);
+
+ # Disable DNS usage.
+ # syslog-ng blocks on DNS queries, so enabling DNS may lead to a DoS attack.
+ use_dns(no);
+ dns-cache(no);
+
+ # Default owner, group, and permissions for log files.
+ owner(root);
+ group(adm);
+ perm(0640);
+
+ # Default permissions for created directories.
+ dir_perm(0755);
+};
+
+
+#
+# Templates
+#
+
+template t_file {
+ template("${YEAR}-${MONTH}-${DAY} ${HOUR}:${MIN}:${SEC} ${LEVEL} ${MSGHDR}${MSG}\n");
+};
+
+
+#
+# Sources
+#
+
+source s_sys {
+ # Standard system log source.
+ system();
+
+ # Messages generated by syslog-ng.
+ internal();
+};
+
+
+#
+# Destinations
+#
+
+destination d_auth { file("/var/log/auth.log" template(t_file)); };
+destination d_boot { file("/var/log/boot.log" template(t_file)); };
+destination d_cron { file("/var/log/cron.log" template(t_file)); };
+destination d_kern { file("/var/log/kern.log" template(t_file)); };
+destination d_mail { file("/var/log/mail.log" template(t_file) flush_lines(10)); };
+destination d_mesg { file("/var/log/messages" template(t_file)); };
+
+# Send messages to console of everyone logged in.
+destination d_cons_all { usertty("*"); };
+
+# Send message to the root's console.
+destination d_cons_root { usertty("root"); };
+
+
+#
+# Filters
+#
+
+filter f_auth { facility(auth, authpriv); };
+filter f_boot { facility(local7); };
+filter f_cron { facility(cron); };
+filter f_emerg { level(emerg); };
+filter f_kern { facility(kern); };
+filter f_mail { facility(mail); };
+
+filter f_default {
+ level(info..emerg)
+ and not (facility(auth)
+ or facility(authpriv)
+ or facility(cron)
+ or facility(kern)
+ or facility(mail));
+};
+
+
+#
+# Logs
+#
+
+log { source(s_sys); filter(f_auth); destination(d_auth); };
+log { source(s_sys); filter(f_boot); destination(d_boot); };
+log { source(s_sys); filter(f_cron); destination(d_cron); };
+log { source(s_sys); filter(f_emerg); destination(d_cons_root); };
+log { source(s_sys); filter(f_kern); destination(d_kern); };
+log { source(s_sys); filter(f_mail); destination(d_mail); };
+log { source(s_sys); filter(f_default); destination(d_mesg); };
+
+# Source additional configuration files (.conf extension only)
+@include "/etc/syslog-ng/conf.d/*.conf"
diff --git a/main/syslog-ng/syslog-ng.initd b/main/syslog-ng/syslog-ng.initd
index 894081fbfa..38144142f8 100755
--- a/main/syslog-ng/syslog-ng.initd
+++ b/main/syslog-ng/syslog-ng.initd
@@ -11,10 +11,6 @@ depend() {
provide logger
}
-start_pre() {
- update
-}
-
start() {
ebegin "Starting syslog-ng"
start-stop-daemon --start --quiet --pidfile /run/syslog-ng.pid --exec /usr/sbin/syslog-ng -- --process-mode background
@@ -37,42 +33,3 @@ reload() {
start-stop-daemon --signal HUP --pidfile /run/syslog-ng.pid --exec /usr/sbin/syslog-ng
eend $?
}
-
-grep_syslog_conf_entries() {
- local section="$1" FN filelist
- grep -v '^#' /etc/syslog-ng/syslog-ng-${section}.std
- filelist=$(find /etc/syslog-ng/ -maxdepth 1 -type f -name "syslog-ng-${section}.*" | grep -Ev ".backup|.std|~")
- if [ $? -eq 0 ]
- then
- for FN in ${filelist}
- do
- grep -v '^#' $FN
- done
- fi
-}
-
-update() {
- local fname='/etc/syslog-ng/syslog-ng.conf'
- local f_tmp="/etc/syslog-ng/syslog-ng.conf.$$"
- for ng_std in options source destination filter log
- do
- [ -f /etc/syslog-ng/syslog-ng-${ng_std}.std ] || exit 1
- done
- {
- # create options entries
- grep_syslog_conf_entries plugins
- echo "options {"
- grep_syslog_conf_entries options
- echo "};"
- # create source entries
- grep_syslog_conf_entries source
- # create destination entries
- grep_syslog_conf_entries destination
- # create filter entries
- grep_syslog_conf_entries filter
- # create log entries
- grep_syslog_conf_entries log
- } > $f_tmp
- cp -p $f_tmp $fname
- rm -f $f_tmp
-}
diff --git a/main/syslog-ng/syslog-ng.logrotate b/main/syslog-ng/syslog-ng.logrotate
index c3fd093418..4b9ad18f35 100644
--- a/main/syslog-ng/syslog-ng.logrotate
+++ b/main/syslog-ng/syslog-ng.logrotate
@@ -1,40 +1,14 @@
-/var/log/auth.log {
- rotate 14
- daily
- missingok
- notifempty
- compress
- postrotate
- /etc/init.d/syslog-ng reload >/dev/null
- endscript
-}
-
-/var/log/mail.log /var/log/mail.info /var/log/mail.warn /var/log/mail.err {
- rotate 8
- weekly
- missingok
- notifempty
- compress
-}
-
-/var/log/kern.log {
- rotate 2
- monthly
- missingok
- notifempty
- compress
- postrotate
- /etc/init.d/syslog-ng reload >/dev/null
- endscript
-}
-
-/var/log/messages /var/log/error.log {
- rotate 14
- weekly
- missingok
- notifempty
- compress
- postrotate
- /etc/init.d/syslog-ng reload >/dev/null
- endscript
+/var/log/auth.log
+/var/log/boot.log
+/var/log/cron.log
+/var/log/kern.log
+/var/log/mail.log
+/var/log/messages
+{
+ notifempty
+ compress
+ sharedscripts
+ postrotate
+ /etc/init.d/syslog-ng --ifstarted reload >/dev/null
+ endscript
}
diff --git a/main/syslog-ng/syslog-ng.post-upgrade b/main/syslog-ng/syslog-ng.post-upgrade
index 0609aceda1..c6308c1b7c 100644
--- a/main/syslog-ng/syslog-ng.post-upgrade
+++ b/main/syslog-ng/syslog-ng.post-upgrade
@@ -12,5 +12,9 @@ if [ "$(apk version -t "$ver_old" "3.18.1-r2")" = "<" ]; then
* If you use one of these, install the relevant package(s), e.g.:
* apk add syslog-ng-redis
*
+ * Custom modularized configuration has been replaced with single
+ * syslog-ng.conf file that loads fragments from /etc/syslog-ng/conf.d
+ * using syslog-ng's include directive.
+ *
EOF
fi