From 9ea091d177fe86f5d2e1e9b7bc4aed3c08101935 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Fri, 28 Nov 2008 08:38:21 -0600 Subject: add syslog-ng for MV --- abs/mv-core/syslog-ng/PKGBUILD | 26 ++++++ abs/mv-core/syslog-ng/log_care.sh | 21 +++++ abs/mv-core/syslog-ng/syslog-ng | 37 +++++++++ abs/mv-core/syslog-ng/syslog-ng.conf | 129 ++++++++++++++++++++++++++++++ abs/mv-core/syslog-ng/syslog-ng.logrotate | 7 ++ abs/mv-core/syslog-ng/syslog.install | 56 +++++++++++++ 6 files changed, 276 insertions(+) create mode 100644 abs/mv-core/syslog-ng/PKGBUILD create mode 100755 abs/mv-core/syslog-ng/log_care.sh create mode 100755 abs/mv-core/syslog-ng/syslog-ng create mode 100644 abs/mv-core/syslog-ng/syslog-ng.conf create mode 100644 abs/mv-core/syslog-ng/syslog-ng.logrotate create mode 100755 abs/mv-core/syslog-ng/syslog.install diff --git a/abs/mv-core/syslog-ng/PKGBUILD b/abs/mv-core/syslog-ng/PKGBUILD new file mode 100644 index 0000000..a9efeee --- /dev/null +++ b/abs/mv-core/syslog-ng/PKGBUILD @@ -0,0 +1,26 @@ +pkgname=syslog-ng +pkgver=2.0.9 +pkgrel=4 +pkgdesc="A portable syslogd replacement with enhanced, flexible configuration scheme." +arch=(i686 x86_64) +license=('GPL') +url="http://www.balabit.com/products/syslog_ng" +makedepends=('flex' 'glib2' 'eventlog') +depends=('tcp_wrappers' 'logrotate') +install=('syslog.install') +provides=('logger') +backup=('etc/syslog-ng.conf') +source=(http://www.balabit.com/downloads/files/syslog-ng/sources/stable/src/$pkgname-$pkgver.tar.gz \ + syslog-ng.conf syslog-ng.logrotate syslog-ng log_care.sh) + +build() { + cd $startdir/src/$pkgname-$pkgver + ./configure --prefix=/usr --sysconfdir=/etc \ + --localstatedir=/var --enable-tcp-wrapper --disable-spoof-source + make || return 1 + make DESTDIR=$startdir/pkg install || return 1 + install -D -m644 ../syslog-ng.conf $startdir/pkg/etc/syslog-ng.conf + install -D -m644 ../syslog-ng.logrotate $startdir/pkg/etc/logrotate.d/syslog-ng + install -D -m755 ../syslog-ng $startdir/pkg/etc/rc.d/syslog-ng + install -D -m755 ../log_care.sh $startdir/pkg/usr/bin/log_care.sh +} diff --git a/abs/mv-core/syslog-ng/log_care.sh b/abs/mv-core/syslog-ng/log_care.sh new file mode 100755 index 0000000..7ca87b9 --- /dev/null +++ b/abs/mv-core/syslog-ng/log_care.sh @@ -0,0 +1,21 @@ +#!/bin/bash +. /etc/profile +DATE=`date +%Y` + +echo "compressing" +find /var/log/$DATE* -mtime +1 -exec gzip -9 {} \; +echo "deleteing" +find /var/log/$DATE* -mtime +7 -exec rm -rf {} \; + +hostname=`hostname` +DATE=`date +%Y-%m-%d` + + cd /var/log || exit 1 + while read symlink target; do + [ -z $target ] && target=$symlink + ln -sf $DATE/$hostname/$symlink $symlink + done <<'EOF' + maillog mail + messages +EOF +ln -sf $DATE/myth_mtc.log myth_mtc.log diff --git a/abs/mv-core/syslog-ng/syslog-ng b/abs/mv-core/syslog-ng/syslog-ng new file mode 100755 index 0000000..ab75b5e --- /dev/null +++ b/abs/mv-core/syslog-ng/syslog-ng @@ -0,0 +1,37 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/syslog-ng` +case "$1" in + start) + stat_busy "Starting Syslog-NG" + [ -z "$PID" ] && /usr/sbin/syslog-ng + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon syslog-ng + stat_done + fi + ;; + stop) + stat_busy "Stopping Syslog-NG" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm -f /var/run/syslog-ng.pid + rm_daemon syslog-ng + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/abs/mv-core/syslog-ng/syslog-ng.conf b/abs/mv-core/syslog-ng/syslog-ng.conf new file mode 100644 index 0000000..f71be35 --- /dev/null +++ b/abs/mv-core/syslog-ng/syslog-ng.conf @@ -0,0 +1,129 @@ +# +# /etc/syslog-ng/syslog-ng.conf +# + +options { + sync (0); + time_reopen (10); + log_fifo_size (1000); + long_hostnames(off); + use_dns (no); + use_fqdn (no); + create_dirs (yes); + keep_hostname (yes); + perm(0655); + dir_perm(0755); + group("log"); + +}; + + +source s_sys { pipe ("/proc/kmsg" log_prefix("kernel: ")); unix-stream ("/dev/log"); internal(); }; +source r_src { tcp(ip("0.0.0.0") port(514)); }; + +destination d_cons { file("/dev/console"); }; + +#destination d_mesg { file("/var/log/messages"); }; + +#destination d_auth { file("/var/log/secure"); }; +#destination d_mail { file("/var/log/maillog"); }; +#destination d_spol { file("/var/log/spooler"); }; + +#destination d_boot { file("/var/log/boot.log"); }; + +#destination d_cron { file("/var/log/cron"); }; +destination d_mlal { usertty("*"); }; +#destination d_kernel { file("/var/log/kern"); }; + +destination d_remote {tcp("127.0.0.1" port(514)) ;} ; + +destination dr_cons { file("/dev/console"); }; +destination dr_mesg { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/messages"); }; +destination dr_auth { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/secure"); }; +destination dr_mail { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/maillog"); }; +destination dr_spol { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/spooler"); }; +#destination dr_boot { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/boot.log"); }; +destination dr_cron { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/cron"); }; +destination dr_acpid { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/acpid"); }; +destination dr_lighttpd { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/lighttpd_access.log"); }; +destination dr_lighttpd_error { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/lighttpd_error.log"); }; +destination dr_dnsmasq { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/dnsmasq"); }; + +destination dr_local0 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/local0"); }; +destination dr_local1 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/local1"); }; +destination dr_local2 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/local2"); }; +destination dr_local3 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/local3"); }; +destination dr_local4 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/local4"); }; +destination dr_local5 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/ncidd.log"); }; +destination dr_local6 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/mythfrontend.log"); }; +destination dr_local7 { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/mythbackend.log"); }; + +destination dr_mlal { usertty("*"); }; +destination dr_kernel { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/kern"); }; +destination dr_everything { file("/var/log/$YEAR-$MONTH-$DAY/$HOST/everything"); }; + +filter f_filter1 { facility(kern); }; +filter f_filter2 { level(info) and +not (facility(mail) or facility(authpriv) or facility(local6) or facility(local7) or program(lighttpd) or facility(cron) or program("kernel")); }; +filter f_filter3 { facility(authpriv); }; +filter f_filter4 { facility(mail); }; +filter f_filter5 { level(emerg); }; +filter f_filter6 { facility(uucp) or +(facility(news) and level(crit)); }; + +#filter f_filter7 { facility(local7); }; + +filter f_filter8 { facility(cron); }; + +#filter f_local0 { facility(local0); }; +#filter f_local1 { facility(local1); }; +#filter f_local2 { facility(local2); }; +#filter f_local3 { facility(local3); }; +filter f_local4 { facility(local4); }; +filter f_local5 { facility(local5); }; +filter f_local6 { facility(local6); }; +filter f_local7 { facility(local7); }; +filter f_kernel { level(info) and program("kernel") and not program(lighttpd); }; +filter f_acpid { match("acpid") and not ( facility(syslog) or program(lighttpd) ) ; }; +filter f_lighttpd { match("lighttpd") and not facility(syslog) ; }; +filter f_lighttpd_error { match("lighttpd") and level(error) and not facility(syslog) ; }; +filter f_dnsmasq { match("dnsmasq") and not (facility(syslog)or program(lighttpd)); }; +filter f_everything { level(debug..emerg) and not (facility(auth,authpriv,syslog) or program(lighttpd)); }; + + + +#log { source(s_sys); filter(f_filter1); destination(d_cons); }; +####log { source(s_sys); filter(f_filter2); destination(d_mesg); }; +#log { source(s_sys); filter(f_filter3); destination(d_auth); }; +#log { source(s_sys); filter(f_filter4); destination(d_mail); }; +#log { source(s_sys); filter(f_filter5); destination(d_mlal); }; +#log { source(s_sys); filter(f_filter6); destination(d_spol); }; +####log { source(s_sys); filter(f_filter7); destination(d_boot); }; +#log { source(s_sys); filter(f_filter8); destination(d_cron); }; +####log { source(s_sys); filter(f_kernel); destination(d_kernel); }; +# +##log { source(r_src); filter(f_filter1); destination(dr_cons); }; +log { source(r_src); filter(f_filter2); destination(dr_mesg); }; +log { source(r_src); filter(f_filter3); destination(dr_auth); }; +log { source(r_src); filter(f_filter4); destination(dr_mail); }; +log { source(r_src); filter(f_filter5); destination(dr_mlal); }; +log { source(r_src); filter(f_filter6); destination(dr_spol); }; +#log { source(r_src); filter(f_filter7); destination(dr_boot); }; +log { source(r_src); filter(f_filter8); destination(dr_cron); }; +#log { source(r_src); filter(f_local0); destination(dr_local0); }; +#log { source(r_src); filter(f_local1); destination(dr_local1); }; +#log { source(r_src); filter(f_local2); destination(dr_local2); }; +#log { source(r_src); filter(f_local3); destination(dr_local3); }; +log { source(r_src); filter(f_local4); destination(dr_local4); }; +log { source(r_src); filter(f_local5); destination(dr_local5); }; +log { source(r_src); filter(f_local6); destination(dr_local6); }; +log { source(r_src); filter(f_local7); destination(dr_local7); }; +log { source(r_src); filter(f_kernel); destination(dr_kernel); }; +log { source(r_src); filter(f_acpid); destination(dr_acpid); }; +log { source(r_src); filter(f_dnsmasq); destination(dr_dnsmasq); }; +log { source(r_src); filter(f_lighttpd); destination(dr_lighttpd); }; +log { source(r_src); filter(f_lighttpd_error); destination(dr_lighttpd_error); }; +log { source(r_src); filter(f_everything); destination(dr_everything); }; +log { source(s_sys); destination (d_remote); }; +# +## vim: syntax=syslog-ng diff --git a/abs/mv-core/syslog-ng/syslog-ng.logrotate b/abs/mv-core/syslog-ng/syslog-ng.logrotate new file mode 100644 index 0000000..3316b53 --- /dev/null +++ b/abs/mv-core/syslog-ng/syslog-ng.logrotate @@ -0,0 +1,7 @@ +/var/log/messages.log /var/log/auth.log /var/log/mail.log /var/log/kernel.log /var/log/errors.log /var/log/daemon.log /var/log/user.log /var/log/iptables.log /var/log/everything.log /var/log/syslog.log { + missingok + sharedscripts + postrotate + /bin/kill -HUP `cat /var/run/syslog-ng.pid 2>/dev/null` 2> /dev/null || true + endscript +} diff --git a/abs/mv-core/syslog-ng/syslog.install b/abs/mv-core/syslog-ng/syslog.install new file mode 100755 index 0000000..014edbd --- /dev/null +++ b/abs/mv-core/syslog-ng/syslog.install @@ -0,0 +1,56 @@ +# This is a default template for a post-install scriptlet. You can +# remove any functions you don't need (and this header). + +# arg 1: the new package version +pre_install() { + /bin/true +} + +# arg 1: the new package version +post_install() { +/bin/true + +} + +# arg 1: the new package version +# arg 2: the old package version +pre_upgrade() { + /bin/true + mv /etc/syslog-ng.conf /etc/syslog-ng.conf.old + +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { +if [ -f /etc/systemconfig ] +then +. /etc/systemconfig +. /etc/profile +#cp /etc/syslog-ng.conf.pacnew /etc/syslog-ng.conf +COMMAND="%s/^destination d_remote.*$/destination d_remote \{tcp\(\"${dbhost}\" port\(514\)\) \;\} \;/" +ex /etc/syslog-ng.conf <