I`m wondering if someone have made working config file with if ... then ... else functions. I made config as following but there is two problems. First - if I add else at end rsyslogd create some weird subdirs and second - messages is not filtered by $syslogtag or this isn`t even implemented in rsyslog?
- Code: Select all
if \
($source == 'host1' \
or \
$source == 'host2') \
and \
($syslogtag != 'xinetd' \
or \
$syslogtag != 'kernel') \
then /var/log/log.log
- Code: Select all
then /var/log/log.log \
else /var/log/otherlog.log
Following is startup script witch I use on RHEL5 Server for rsyslogd 3.* without klogd in case someone need
- Code: Select all
#!/bin/bash
# chkconfig: 2345 12 88
# Source function library.
. /etc/init.d/functions
RETVAL=0
start() {
[ -x /usr/local/sbin/rsyslogd ] || exit 5
# Source config
if [ -f /etc/sysconfig/rsyslog ] ; then
. /etc/sysconfig/rsyslog
else
SYSLOGD_OPTIONS="-c3"
fi
umask 077
echo -n $"Starting system logger (rsyslog): "
daemon rsyslogd $SYSLOGD_OPTIONS
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Shutting down system logger (rsyslog): "
killproc rsyslogd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rsyslog
return $RETVAL
}
rhstatus() {
status rsyslogd
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rhstatus
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/rsyslog ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 2
esac
exit $?


