From 1d3b9e8d5c0bb0058106e2fb7e5a2754b6e62a82 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Tue, 31 Oct 2006 17:31:31 +0000 Subject: configuration of syslog-ng for SuSE should work now ... (added new function for writing the config file - sysngwriter in functions) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@499 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/etc/functions | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'initramfs/initrd-stuff/etc/functions') diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 17bb1053..4cb18574 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -2,7 +2,7 @@ # (included by init, hwautocfg, servconfig, ... within OpenSLX initial # ramfs) # -# Dirk von Suchodoletz , 13-10-2006 +# Dirk von Suchodoletz , 31-10-2006 # Felix Endres, 30-04-2006 # (xenbr), 27-09-2006 # Tobias Maier @@ -483,6 +483,41 @@ testmkd () { test -d $1 || mkdir -p $1 >/dev/null 2>&1 } +############################################################################# +# function for writing a syslog-ng.conf file. First parameter is absolute +# destination (incl. /mnt prefix) +# sysngwriter $dest $start_syslog +sysngwriter () { +syslogngcfg=$1 +# logging servers might be specified in $log_servers (from e.g. dhcp) +# fixme!? only first logserver from dhcp variable is used +[ -n "$log_servers" ] && start_syslog="syslog://${log_servers% *}:514/udp" +echo -e "# File written by $0 within InitRamFS\n\ +source src {\n\tfile(\"/proc/kmsg\") log_prefix(\"kernel: \");\n\ +\tunix-stream(\"/dev/log\");\n\tinternal();\n};\ndestination console_all {\ +file(\"/dev/tty10\"); };" >$syslogngcfg +case "$start_syslog" in + yes|Yes|YES) + : # already defined + ;; + file) + echo -e "destination allmessages { file(\"/var/log/allmessages\"); };\n\ +log { source(src); destination(allmessages); };" \ + >>$syslogngcfg + ;; + *) + syslogsrv=$(uri_token $start_syslog server) + syslogport=$(uri_token $start_syslog port) + syslogprot=$(uri_token $start_syslog path) + [ -z ${syslogport} ] && syslogport=514 + [ -z ${syslogprot} ] && syslogprot=udp + echo -e "destination loghost {\n\t${syslogprot}(\"${syslogsrv}\" \ +port(${syslogport}));\n};\nlog {\n\tsource(src); destination(loghost);\n};" \ + >>$syslogngcfg + ;; +esac +} + ############################################################################# # simple basename replacement basename () { -- cgit v1.2.3-55-g7522