Switch to a more recent version of syslog-ng
Existing alpine image used to build the syslog-ng container
is very old and does not support arm64 arch.
Move to alpine 3.13.4 which is built for multi-arch. This
upgrades the syslog-ng version from 3.7 to 3.30, and with it
come changes on how to configure it. The .std and .out files
are redundant, instead use a single syslog-ng.conf to
provide all custom configuration.
Change-Id: I9aa87cb3a99279b491592f221084aedf903959a4
diff --git a/src/test/docker/docker-syslog-ng-stdout/Dockerfile b/src/test/docker/docker-syslog-ng-stdout/Dockerfile
index 11f3059..52c1e64 100644
--- a/src/test/docker/docker-syslog-ng-stdout/Dockerfile
+++ b/src/test/docker/docker-syslog-ng-stdout/Dockerfile
@@ -1,10 +1,10 @@
-FROM alpine:3.4
+FROM alpine:3.13.4
MAINTAINER Ryan Schlesinger <ryan@outstand.com>
RUN apk add --no-cache bash syslog-ng
RUN mkdir /sidecar
-COPY config/* /etc/syslog-ng/
+COPY config/syslog-ng.conf /etc/syslog-ng/
COPY docker-entrypoint.sh /docker-entrypoint.sh
VOLUME ["/sidecar"]
CMD ["syslog-ng", "-F"]
diff --git a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-destination.out b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-destination.out
deleted file mode 100644
index 170f7e4..0000000
--- a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-destination.out
+++ /dev/null
@@ -1 +0,0 @@
- destination d_stdout { pipe("/dev/stdout"); };
diff --git a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-log.out b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-log.out
deleted file mode 100644
index 6901c41..0000000
--- a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-log.out
+++ /dev/null
@@ -1 +0,0 @@
-log { source(s_all); destination(d_stdout); };
diff --git a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-plugins.std b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-plugins.std
deleted file mode 100644
index ef0ce3e..0000000
--- a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-plugins.std
+++ /dev/null
@@ -1 +0,0 @@
-@version: 3.7
diff --git a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-source.sidecar b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-source.sidecar
deleted file mode 100644
index 1181f78..0000000
--- a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-source.sidecar
+++ /dev/null
@@ -1,5 +0,0 @@
-# sidecar log source for mounting between docker containers
- network(
- transport("udp")
- port("514")
- );
diff --git a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-source.std b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-source.std
deleted file mode 100644
index 5a50916..0000000
--- a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng-source.std
+++ /dev/null
@@ -1,8 +0,0 @@
-# ---------------------------------------------------------------------------------
-# Default syslog-ng sources; Do not edit this file!
-# append source with line on a file: syslog-ng-source.<package>
-# ---------------------------------------------------------------------------------
-# 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");
diff --git a/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng.conf b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng.conf
new file mode 100644
index 0000000..94cdac9
--- /dev/null
+++ b/src/test/docker/docker-syslog-ng-stdout/config/syslog-ng.conf
@@ -0,0 +1,136 @@
+@version:3.30
+@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();
+#};
+
+# customisation
+source s_all {
+ internal();
+ unix-dgram("/dev/log");
+ network(
+ transport("udp")
+ port(514)
+ );
+};
+
+
+#
+# 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"); };
+
+# customisation
+destination d_stdout { pipe("/dev/stdout"); };
+
+
+#
+# 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); };
+
+# customisation
+log { source(s_all); destination(d_stdout); };
+
+# Source additional configuration files (.conf extension only)
+#@include "/etc/syslog-ng/conf.d/*.conf"
\ No newline at end of file
diff --git a/src/test/docker/docker-syslog-ng-stdout/docker-entrypoint.sh b/src/test/docker/docker-syslog-ng-stdout/docker-entrypoint.sh
index be51a09..79e09ec 100755
--- a/src/test/docker/docker-syslog-ng-stdout/docker-entrypoint.sh
+++ b/src/test/docker/docker-syslog-ng-stdout/docker-entrypoint.sh
@@ -1,49 +1,4 @@
#!/bin/bash
-# The following two methods are ripped from alpine's syslog-ng package.
-# This allows us (and a user) to customize the config with snippets.
-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
- echo "source s_all {"
- grep_syslog_conf_entries source
- echo "};"
- # 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
-}
-
-update
-
echo Starting "$@"
exec "$@"