Subject: [alpine-devel] [PATCH] main/syslog-ng: new package

From: Jens Vehlhaber <[email-masked]>
Date: Wed, 22 May 2013 11:44:16 +0200

Hello developers,

interested in a syslog-ng package with configuration templates?

Kind regards,
Jens

---
  main/libeventlog/APKBUILD                | 37 ++++++++++++++++
  main/syslog-ng/APKBUILD                  | 66 +++++++++++++++++++++++++++
  main/syslog-ng/syslog-ng-destination.std | 22 +++++++++
  main/syslog-ng/syslog-ng-filter.std      | 32 ++++++++++++++
  main/syslog-ng/syslog-ng-log.std         | 56 +++++++++++++++++++++++
  main/syslog-ng/syslog-ng-options.std     | 43 ++++++++++++++++++
  main/syslog-ng/syslog-ng-source.std      | 10 +++++
  main/syslog-ng/syslog-ng.initd           | 76 
++++++++++++++++++++++++++++++++
  main/syslog-ng/syslog-ng.post-install    | 11 +++++
  main/syslog-ng/syslog-ng.post-upgrade    |  3 ++
  main/syslog-ng/syslog-ng.pre-deinstall   |  7 +++
  main/syslog-ng/syslog-ng.pre-install     |  6 +++
  main/syslog-ng/syslog-ng.pre-upgrade     |  6 +++
  main/syslog-ng/syslog.logrotate          | 40 +++++++++++++++++

diff --git a/main/libeventlog/APKBUILD b/main/libeventlog/APKBUILD
new file mode 100644
index 0000000..b85f21e
--- /dev/null
+++ b/main/libeventlog/APKBUILD
@@ -0,0 +1,37 @@
+# Contributor: jv [email-masked]
+# Maintainer: jv [email-masked]
+pkgname=libeventlog
+pkgver=0.2.12
+pkgrel=0
+pkgdesc="Syslog event logger library"
+url="http://www.balabit.com"
+arch="all"
+license="GNU"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-dev"
+source="http://www.balabit.com/downloads/files?path=/syslog-ng/sources/3.3.9/source/eventlog_${pkgver}.tar.gz"
+
+_builddir="$srcdir/eventlog-$pkgver"
+
+prepare() {
+	cd "$_builddir"
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr || return 1
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make -j1 DESTDIR="$pkgdir" install || return 1
+	rm -f  ${pkgdir}/usr/lib/*.la
+	strip -R .note -R .comment ${pkgdir}/usr/lib/*.so.*
+	return 0
+}
+
+md5sums="7d95392a6618437a0404a3fadb49f53e  eventlog_0.2.12.tar.gz"
diff --git a/main/syslog-ng/APKBUILD b/main/syslog-ng/APKBUILD
new file mode 100644
index 0000000..6a2d385
--- /dev/null
+++ b/main/syslog-ng/APKBUILD
@@ -0,0 +1,66 @@
+# Contributor: jv <[email-masked]>
+# Maintainer: jv <[email-masked]>
+pkgname=syslog-ng
+pkgver=2.1.4
+pkgrel=0
+pkgdesc="Syslog-NG"
+url="http://www.balabit.com"
+arch="all"
+license="GNU"
+depends="glib libeventlog"
+depends_dev="glib-dev libeventlog-dev"
+makedepends="$depends_dev"
+install="$pkgname.pre-install $pkgname.post-install 
$pkgname.pre-deinstall $pkgname.pre-upgrade $pkgname.post-upgrade"
+subpackages=""
+
+source="http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/${pkgver}/source/syslog-ng_${pkgver}.tar.gz
+	syslog.logrotate
+	syslog-ng.initd
+	syslog-ng-destination.std
+	syslog-ng-filter.std
+	syslog-ng-log.std
+	syslog-ng-options.std
+	syslog-ng-source.std
+	"
+
+_builddir="$srcdir/${pkgname}-$pkgver"
+
+prepare() {
+	cd "$_builddir"
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr \
+	--sysconfdir=/etc/syslog-ng \
+	--enable-ipv6 \
+	--disable-sql \
+	--disable-mongodb \
+	--disable-json \
+	|| return 1
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make -j1 DESTDIR=${pkgdir} install || return 1
+	rm -rf ${pkgdir}/usr/share
+	strip -R .note -R .comment ${pkgdir}/usr/bin/*
+	strip -R .note -R .comment ${pkgdir}/usr/sbin/*
+	install -D -m755 "$srcdir"/$pkgname.initd 
${pkgdir}/etc/init.d/$pkgname || return 1
+	install -D -m644 "$srcdir"/syslog-ng-destination.std 
${pkgdir}/etc/syslog-ng/syslog-ng-destination.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-filter.std 
${pkgdir}/etc/syslog-ng/syslog-ng-filter.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-log.std 
${pkgdir}/etc/syslog-ng/syslog-ng-log.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-options.std 
${pkgdir}/etc/syslog-ng/syslog-ng-options.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-source.std 
${pkgdir}/etc/syslog-ng/syslog-ng-source.std || return 1
+	install -D -m644 "$srcdir"/syslog.logrotate 
${pkgdir}/etc/logrotate.d/syslog || return 1
+}
+
+md5sums="17c4c7725d2eab62b588395f1ed93f32  syslog-ng_2.1.4.tar.gz
+8916d55f8213d2746e8c2a6a89c29d6c  syslog.logrotate
+aca6b42ddecec1fbf7cebdf158496feb  syslog-ng.initd
+f0b4a0b530e269c51bc63f5b9d817c9b  syslog-ng-destination.std
+13654597e779e4ae072f93fe9a5647bc  syslog-ng-filter.std
+1c7359cd41b2b752c163a930399d1d46  syslog-ng-log.std
+a5dad3b437c5a2a7ce13d466abd1dce4  syslog-ng-options.std
+b678eb6de7a3c42c8c956a6a4462f6c7  syslog-ng-source.std"
diff --git a/main/syslog-ng/syslog-ng-destination.std 
b/main/syslog-ng/syslog-ng-destination.std
new file mode 100644
index 0000000..93bc303
--- /dev/null
+++ b/main/syslog-ng/syslog-ng-destination.std
@@ -0,0 +1,22 @@
+# 
---------------------------------------------------------------------------------
+# 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
new file mode 100644
index 0000000..f462e3f
--- /dev/null
+++ b/main/syslog-ng/syslog-ng-filter.std
@@ -0,0 +1,32 @@
+# 
---------------------------------------------------------------------------------
+# 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); };
diff --git a/main/syslog-ng/syslog-ng-log.std 
b/main/syslog-ng/syslog-ng-log.std
new file mode 100644
index 0000000..12dc4d5
--- /dev/null
+++ b/main/syslog-ng/syslog-ng-log.std
@@ -0,0 +1,56 @@
+# 
---------------------------------------------------------------------------------
+# 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_at_least_err);
+        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
new file mode 100644
index 0000000..b71ad15
--- /dev/null
+++ b/main/syslog-ng/syslog-ng-options.std
@@ -0,0 +1,43 @@
+# 
---------------------------------------------------------------------------------
+# 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);
+# Some program send log messages through a private implementation.
+# and sometimes that implementation is bad. If this happen syslog-ng
+# may recognise the program name as hostname. Whit this option
+# we tell the syslog-ng that if a hostname match this regexp than that
+# is not a real hostname.
+  bad_hostname("^gconfd$");
diff --git a/main/syslog-ng/syslog-ng-source.std 
b/main/syslog-ng/syslog-ng-source.std
new file mode 100644
index 0000000..d1da1a0
--- /dev/null
+++ b/main/syslog-ng/syslog-ng-source.std
@@ -0,0 +1,10 @@
+# 
---------------------------------------------------------------------------------
+# 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-stream("/dev/log");
+# messages from the kernel
+  file("/proc/kmsg" log_prefix("kernel: "));
diff --git a/main/syslog-ng/syslog-ng.initd b/main/syslog-ng/syslog-ng.initd
new file mode 100644
index 0000000..a98def2
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.initd
@@ -0,0 +1,76 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="update"
+extra_started_commands="reload"
+
+depend() {
+	need hostname localmount
+	before net
+	provide logger
+}
+
+start() {
+	[ ! -f /etc/syslog-ng/syslog.conf ] && update
+	ebegin "Starting syslog-ng"
+	start-stop-daemon --start --quiet --exec /usr/sbin/syslog-ng --pidfile 
/var/run/syslog-ng.pid
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping syslog-ng"
+	start-stop-daemon --stop --quiet --pidfile /var/run/syslog-ng.pid 
--exec /usr/sbin/syslog-ng
+	eend $?
+}
+
+reload() {
+	if [ ! -f /var/run/syslog-ng.pid ]
+	then
+		eerror "syslog-ng not running!"
+		return 1
+	fi
+	ebegin "Reloading syslog-ng"
+	start-stop-daemon --signal HUP --pidfile /var/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
+		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
+}
diff --git a/main/syslog-ng/syslog-ng.post-install 
b/main/syslog-ng/syslog-ng.post-install
new file mode 100644
index 0000000..c21ac31
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.post-install
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+/etc/init.d/syslog stop
+[ -e /etc/runlevels/boot/syslog ] && /sbin/rc-update del syslog boot
+[ -e /etc/runlevels/boot/sysctl ] && /sbin/rc-update del sysctl boot
+/sbin/rc-update add syslog-ng boot
+[ ! -f /var/log/auth.log ] && touch /var/log/auth.log
+[ ! -f /var/log/error.log ] && touch /var/log/error.log
+[ ! -f /var/log/mail.log ] && touch /var/log/mail.log
+[ ! -f /var/log/kern.log ] && touch /var/log/kern.log
+/etc/init.d/syslog-ng start
diff --git a/main/syslog-ng/syslog-ng.post-upgrade 
b/main/syslog-ng/syslog-ng.post-upgrade
new file mode 100644
index 0000000..eae07a9
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.post-upgrade
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/etc/init.d/syslog-ng start
diff --git a/main/syslog-ng/syslog-ng.pre-deinstall 
b/main/syslog-ng/syslog-ng.pre-deinstall
new file mode 100644
index 0000000..0a74c24
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.pre-deinstall
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+/etc/init.d/syslog-ng stop
+/sbin/rc-update del syslog-ng boot
+/sbin/rc-update add syslog boot
+/sbin/rc-update add sysctl boot
+/etc/init.d/syslog start
diff --git a/main/syslog-ng/syslog-ng.pre-install 
b/main/syslog-ng/syslog-ng.pre-install
new file mode 100644
index 0000000..e60d17d
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm -f /etc/syslog-ng/syslog-ng-*.std
+rm -f /etc/syslog-ng/*.apk*
+rm -f /etc/logrotate.d/*.apk*
+rm -f /etc/logrotate.d/syslog
diff --git a/main/syslog-ng/syslog-ng.pre-upgrade 
b/main/syslog-ng/syslog-ng.pre-upgrade
new file mode 100644
index 0000000..6c1aaca
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.pre-upgrade
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm -f /etc/syslog-ng/syslog-ng-*.std
+rm -f /etc/syslog-ng/*.apk*
+rm -f /etc/logrotate.d/*.apk*
+/etc/init.d/syslog-ng stop
diff --git a/main/syslog-ng/syslog.logrotate 
b/main/syslog-ng/syslog.logrotate
new file mode 100644
index 0000000..c3fd093
--- /dev/null
+++ b/main/syslog-ng/syslog.logrotate
@@ -0,0 +1,40 @@
+/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
+}
-- 
1.8.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Thu, 23 May 2013 21:58:20 +0200

On Wed, 22 May 2013 11:44:16 +0200

> Hello developers,

Hi!

> interested in a syslog-ng package with configuration templates?

Thank you very much! 

I have a few comments...

...
> +++ b/main/libeventlog/APKBUILD

New packages should be added to testing subdirectory. Once its tested
we move it to main.

GPL/GPLv2/GPLv2+/GPL3/LGPL?

> +	strip -R .note -R .comment ${pkgdir}/usr/lib/*.so.*

abuild will strip.
http://git.alpinelinux.org/cgit/abuild/tree/abuild.in#n1568

> +++ b/main/syslog-ng/APKBUILD

You don't need add those to depends. abuild will use scanelf to
automatically detect the elf dependencies.

> $pkgname.pre-deinstall $pkgname.pre-upgrade $pkgname.post-upgrade"

...
> diff --git a/main/syslog-ng/syslog-ng.initd
> b/main/syslog-ng/syslog-ng.initd new file mode 100644
> index 0000000..a98def2
> --- /dev/null

Reuse of gentoo's init.d. good!

> +++ b/main/syslog-ng/syslog-ng.post-install

I don't like this. we should not change what services to start from
install scripts.

Care to fix those thing up and send a new?

Thanks!

-nc

---

---

From: Jens Vehlhaber <[email-masked]>
Date: Fri, 24 May 2013 11:47:41 +0200

Hi,

the fixed version:
- moved to testing
- correct license informations
- service installation in the installation script removed

Kind regards,
Jens

---
  testing/libeventlog/APKBUILD                | 36 ++++++++++++++
  testing/syslog-ng/APKBUILD                  | 64 ++++++++++++++++++++++++
  testing/syslog-ng/syslog-ng-destination.std | 22 +++++++++
  testing/syslog-ng/syslog-ng-filter.std      | 32 ++++++++++++
  testing/syslog-ng/syslog-ng-log.std         | 56 +++++++++++++++++++++
  testing/syslog-ng/syslog-ng-options.std     | 43 ++++++++++++++++
  testing/syslog-ng/syslog-ng-source.std      | 10 ++++
  testing/syslog-ng/syslog-ng.initd           | 76 
+++++++++++++++++++++++++++++
  testing/syslog-ng/syslog-ng.logrotate       | 40 +++++++++++++++
  testing/syslog-ng/syslog-ng.post-install    |  9 ++++
  testing/syslog-ng/syslog-ng.post-upgrade    |  3 ++
  testing/syslog-ng/syslog-ng.pre-deinstall   |  6 +++
  testing/syslog-ng/syslog-ng.pre-install     |  4 ++
  testing/syslog-ng/syslog-ng.pre-upgrade     |  5 ++
  14 files changed, 406 insertions(+)
  create mode 100644 testing/libeventlog/APKBUILD
  create mode 100644 testing/syslog-ng/APKBUILD
  create mode 100644 testing/syslog-ng/syslog-ng-destination.std
  create mode 100644 testing/syslog-ng/syslog-ng-filter.std
  create mode 100644 testing/syslog-ng/syslog-ng-log.std
  create mode 100644 testing/syslog-ng/syslog-ng-options.std
  create mode 100644 testing/syslog-ng/syslog-ng-source.std
  create mode 100644 testing/syslog-ng/syslog-ng.initd
  create mode 100644 testing/syslog-ng/syslog-ng.logrotate
  create mode 100644 testing/syslog-ng/syslog-ng.post-install
  create mode 100644 testing/syslog-ng/syslog-ng.post-upgrade
  create mode 100644 testing/syslog-ng/syslog-ng.pre-deinstall
  create mode 100644 testing/syslog-ng/syslog-ng.pre-install
  create mode 100644 testing/syslog-ng/syslog-ng.pre-upgrade

diff --git a/testing/libeventlog/APKBUILD b/testing/libeventlog/APKBUILD
new file mode 100644
index 0000000..5825efc
--- /dev/null
+++ b/testing/libeventlog/APKBUILD
@@ -0,0 +1,36 @@
+# Contributor: jv [email-masked]
+# Maintainer: jv [email-masked]
+pkgname=libeventlog
+pkgver=0.2.12
+pkgrel=0
+pkgdesc="Syslog event logger library"
+url="http://www.balabit.com"
+arch="all"
+license="BSD-3-clause"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-dev"
+source="http://www.balabit.com/downloads/files?path=/syslog-ng/sources/3.3.9/source/eventlog_${pkgver}.tar.gz"
+
+_builddir="$srcdir/eventlog-$pkgver"
+
+prepare() {
+	cd "$_builddir"
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr || return 1
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make -j1 DESTDIR="$pkgdir" install || return 1
+	rm -f  ${pkgdir}/usr/lib/*.la
+	return 0
+}
+
+md5sums="7d95392a6618437a0404a3fadb49f53e  eventlog_0.2.12.tar.gz"
diff --git a/testing/syslog-ng/APKBUILD b/testing/syslog-ng/APKBUILD
new file mode 100644
index 0000000..390651b
--- /dev/null
+++ b/testing/syslog-ng/APKBUILD
@@ -0,0 +1,64 @@
+# Contributor: jv <[email-masked]>
+# Maintainer: jv <[email-masked]>
+pkgname=syslog-ng
+pkgver=2.1.4
+pkgrel=0
+pkgdesc="Next generation logging daemon"
+url="http://www.balabit.com"
+arch="all"
+license="GPLv2"
+depends=""
+depends_dev="glib-dev libeventlog-dev"
+makedepends="$depends_dev"
+install="$pkgname.pre-install $pkgname.post-install 
$pkgname.pre-deinstall $pkgname.pre-upgrade $pkgname.post-upgrade"
+subpackages=""
+
+source="http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/${pkgver}/source/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-source.std
+	"
+
+_builddir="$srcdir/${pkgname}-$pkgver"
+
+prepare() {
+	cd "$_builddir"
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr \
+	--sysconfdir=/etc/syslog-ng \
+	--enable-ipv6 \
+	--disable-sql \
+	--disable-mongodb \
+	--disable-json \
+	|| return 1
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make -j1 DESTDIR=${pkgdir} install || return 1
+	rm -rf ${pkgdir}/usr/share
+	install -D -m755 "$srcdir"/$pkgname.initd 
${pkgdir}/etc/init.d/$pkgname || return 1
+	install -D -m644 "$srcdir"/syslog-ng-destination.std 
${pkgdir}/etc/syslog-ng/syslog-ng-destination.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-filter.std 
${pkgdir}/etc/syslog-ng/syslog-ng-filter.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-log.std 
${pkgdir}/etc/syslog-ng/syslog-ng-log.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-options.std 
${pkgdir}/etc/syslog-ng/syslog-ng-options.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng-source.std 
${pkgdir}/etc/syslog-ng/syslog-ng-source.std || return 1
+	install -D -m644 "$srcdir"/syslog-ng.logrotate 
${pkgdir}/etc/logrotate.d/syslog-ng || return 1
+}
+
+md5sums="17c4c7725d2eab62b588395f1ed93f32  syslog-ng_2.1.4.tar.gz
+8916d55f8213d2746e8c2a6a89c29d6c  syslog-ng.logrotate
+aca6b42ddecec1fbf7cebdf158496feb  syslog-ng.initd
+f0b4a0b530e269c51bc63f5b9d817c9b  syslog-ng-destination.std
+13654597e779e4ae072f93fe9a5647bc  syslog-ng-filter.std
+1c7359cd41b2b752c163a930399d1d46  syslog-ng-log.std
+a5dad3b437c5a2a7ce13d466abd1dce4  syslog-ng-options.std
+b678eb6de7a3c42c8c956a6a4462f6c7  syslog-ng-source.std"
diff --git a/testing/syslog-ng/syslog-ng-destination.std 
b/testing/syslog-ng/syslog-ng-destination.std
new file mode 100644
index 0000000..93bc303
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng-destination.std
@@ -0,0 +1,22 @@
+# 
---------------------------------------------------------------------------------
+# 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/testing/syslog-ng/syslog-ng-filter.std 
b/testing/syslog-ng/syslog-ng-filter.std
new file mode 100644
index 0000000..f462e3f
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng-filter.std
@@ -0,0 +1,32 @@
+# 
---------------------------------------------------------------------------------
+# 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); };
diff --git a/testing/syslog-ng/syslog-ng-log.std 
b/testing/syslog-ng/syslog-ng-log.std
new file mode 100644
index 0000000..12dc4d5
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng-log.std
@@ -0,0 +1,56 @@
+# 
---------------------------------------------------------------------------------
+# 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_at_least_err);
+        destination(df_error);
+};
+# *.emerg                         *
+log {
+        source(s_all);
+        filter(f_emerg);
+        destination(du_all);
+};
diff --git a/testing/syslog-ng/syslog-ng-options.std 
b/testing/syslog-ng/syslog-ng-options.std
new file mode 100644
index 0000000..b71ad15
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng-options.std
@@ -0,0 +1,43 @@
+# 
---------------------------------------------------------------------------------
+# 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);
+# Some program send log messages through a private implementation.
+# and sometimes that implementation is bad. If this happen syslog-ng
+# may recognise the program name as hostname. Whit this option
+# we tell the syslog-ng that if a hostname match this regexp than that
+# is not a real hostname.
+  bad_hostname("^gconfd$");
diff --git a/testing/syslog-ng/syslog-ng-source.std 
b/testing/syslog-ng/syslog-ng-source.std
new file mode 100644
index 0000000..d1da1a0
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng-source.std
@@ -0,0 +1,10 @@
+# 
---------------------------------------------------------------------------------
+# 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-stream("/dev/log");
+# messages from the kernel
+  file("/proc/kmsg" log_prefix("kernel: "));
diff --git a/testing/syslog-ng/syslog-ng.initd 
b/testing/syslog-ng/syslog-ng.initd
new file mode 100644
index 0000000..a98def2
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.initd
@@ -0,0 +1,76 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="update"
+extra_started_commands="reload"
+
+depend() {
+	need hostname localmount
+	before net
+	provide logger
+}
+
+start() {
+	[ ! -f /etc/syslog-ng/syslog.conf ] && update
+	ebegin "Starting syslog-ng"
+	start-stop-daemon --start --quiet --exec /usr/sbin/syslog-ng --pidfile 
/var/run/syslog-ng.pid
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping syslog-ng"
+	start-stop-daemon --stop --quiet --pidfile /var/run/syslog-ng.pid 
--exec /usr/sbin/syslog-ng
+	eend $?
+}
+
+reload() {
+	if [ ! -f /var/run/syslog-ng.pid ]
+	then
+		eerror "syslog-ng not running!"
+		return 1
+	fi
+	ebegin "Reloading syslog-ng"
+	start-stop-daemon --signal HUP --pidfile /var/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
+		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
+}
diff --git a/testing/syslog-ng/syslog-ng.logrotate 
b/testing/syslog-ng/syslog-ng.logrotate
new file mode 100644
index 0000000..c3fd093
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.logrotate
@@ -0,0 +1,40 @@
+/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
+}
diff --git a/testing/syslog-ng/syslog-ng.post-install 
b/testing/syslog-ng/syslog-ng.post-install
new file mode 100644
index 0000000..8939246
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.post-install
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo "please remove other syslog services and activate syslog-ng with:"
+echo "rc-service syslog-ng start"
+echo "rc-update add syslog-ng boot"
+[ ! -f /var/log/auth.log ] && touch /var/log/auth.log
+[ ! -f /var/log/error.log ] && touch /var/log/error.log
+[ ! -f /var/log/mail.log ] && touch /var/log/mail.log
+[ ! -f /var/log/kern.log ] && touch /var/log/kern.log
diff --git a/testing/syslog-ng/syslog-ng.post-upgrade 
b/testing/syslog-ng/syslog-ng.post-upgrade
new file mode 100644
index 0000000..8935de6
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.post-upgrade
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rc-service syslog-ng start
diff --git a/testing/syslog-ng/syslog-ng.pre-deinstall 
b/testing/syslog-ng/syslog-ng.pre-deinstall
new file mode 100644
index 0000000..3542d8d
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.pre-deinstall
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+/etc/init.d/syslog-ng stop
+/sbin/rc-update del syslog-ng boot
+echo "please activate a syslog service, example:"
+echo "rc-update add syslog boot"
diff --git a/testing/syslog-ng/syslog-ng.pre-install 
b/testing/syslog-ng/syslog-ng.pre-install
new file mode 100644
index 0000000..e96a11a
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.pre-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+rm -f /etc/syslog-ng/syslog-ng-*.std
+rm -f /etc/syslog-ng/*.apk*
diff --git a/testing/syslog-ng/syslog-ng.pre-upgrade 
b/testing/syslog-ng/syslog-ng.pre-upgrade
new file mode 100644
index 0000000..0b1b8f8
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.pre-upgrade
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+rm -f /etc/syslog-ng/syslog-ng-*.std
+rm -f /etc/syslog-ng/*.apk*
+rc-service syslog-ng stop
-- 
1.8.0

---