FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
#!/bin/sh # Copyright (c) 2007-2008 Volker Theile (votdev@gmx.de) # All rights reserved. # PROVIDE: syslogd # REQUIRE: mountcritlocal cleanvar NETWORKING # BEFORE: SERVERS . /etc/rc.subr . /etc/configxml.subr name="syslogd" rcvar=`set_rcvar` load_rc_config "$name" # Defaults syslogd_enable=${syslogd_enable:-"NO"} syslogd_config=${syslogd_config:-"/var/etc/syslog.conf"} pidfile="/var/run/syslog.pid" command="/usr/sbin/${name}" command_args="-f ${syslogd_config}" # Custom commands start_precmd="start_precmd" extra_commands="reload mkconf" reload_precmd="reload_precmd" mkconf_cmd="mkconf_cmd" # Check if syslog'ing to remote syslog server is disabled if ! configxml_isset //syslogd/remote/enable; then syslogd_flags="-ss" command_args="-f ${syslogd_config}" fi mkconf_cmd() { echo "local3.* %/var/log/sshd.log local4.* %/var/log/rsyncd.log local5.* %/var/log/smartd.log ftp.* %/var/log/ftp.log daemon.* %/var/log/daemon.log *.notice;kern.debug;lpr.info;mail.crit;mail.info;news.err;local0.none;local7.none %/var/log/system.log security.* %/var/log/system.log auth.info;authpriv.info %/var/log/system.log *.emerg *" > ${syslogd_config} # Add remote server configuration if syslog'ing to remote syslog server is enabled /usr/local/bin/xml sel -t \ -i "//syslogd/remote/enable" \ -i "//syslogd/remote/ftp" \ -o "ftp.* @" -v "//syslogd/remote/ipaddr" -n -b \ -i "//syslogd/remote/sshd" \ -o "local3.* @" -v "//syslogd/remote/ipaddr" -n -b \ -i "//syslogd/remote/rsyncd" \ -o "local4.* @" -v "//syslogd/remote/ipaddr" -n -b \ -i "//syslogd/remote/smartd" \ -o "local5.* @" -v "//syslogd/remote/ipaddr" -n -b \ -i "//syslogd/remote/daemon" \ -o "daemon.* @" -v "//syslogd/remote/ipaddr" -n -b \ -i "//syslogd/remote/system" \ -o "*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local7.none @" -v "//syslogd/remote/ipaddr" -n \ -o "security.* @" -v "//syslogd/remote/ipaddr" -n \ -o "auth.info;authpriv.info @" -v "//syslogd/remote/ipaddr" -n \ -o "*.emerg @" -v "//syslogd/remote/ipaddr" -n -b \ -b \ ${configxml_file} | /usr/local/bin/xml unesc >> ${syslogd_config} } reload_precmd() { # Clear existing file cat /dev/null > ${syslogd_config} # Create configuration file mkconf_cmd } start_precmd() { reload_precmd } run_rc_command "$1"