1) KISS may be the better appraoch, so this needs to be reviewed. 2) The defaults settings for the rsyslog are in this patch, and I would like for them to be reviewed. THanks! -- bk
Bryan Kearney
2008-Nov-05 21:55 UTC
[Ovirt-devel] [PATCH node] Add remote logging configuration. This version only supports manual configuration
--- scripts/ovirt-config-logging | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 108 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 8b13789..345e79d 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -1 +1,109 @@ +#!/bin/bash +# +# Configures the rsyslog daemon. +RSYSLOG_FILE="/etc/rsyslog.conf" + +# Creates the rsyslog file based on the following inputs +# $1 ipaddress of remote syslog server +# $2 port of remote syslog server +# $3 protocol (tcp or udp) +function ovirt_rsyslog { + +DELIM="" + +if [[ "$3" = "tcp" ]]; then + DELIM="@@" +else + DELIM="@" +fi + +cat > $RSYSLOG_FILE << EOF +#ovirt rsyslog config file + +#### MODULES #### +\$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) +\$ModLoad imklog.so # provides kernel logging support (previously done by rklogd) + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### RULES #### +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg * + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + +\$WorkDirectory /var/spppl/rsyslog +\$ActionQueueFileName ovirtNode +\$ActionQueueMaxDiskSpace 10m +\$ActionQueueSaveOnShutdown on +\$ActionQueueType LinkedList +\$ActionResumeRetryCount -1 +*.* $DELIM$1:$2 +EOF +} + +function prompt_user { + while true ; do + printf "\nWhat is the IP address or server name for the syslog server? " + read + SYSLOG_SERVER_IP=$REPLY + printf "\nWHat port does the syslog daemon run on? " + read + if [[ "$REPLY" =~ '^[0-9.]+$' ]]; then + SYSLOG_SERVER_PORT=$REPLY + NICS="$NICS Quit" + + PROTOCOLS="tcp udp" + PS3="Please select a the protocol to use: " + select SYSLOG_SERVER_PROTOCOL in $PROTOCOLS; + do + case $SYSLOG_SERVER_PROTOCOL in + "tcp") + break ;; + "udp") + break;; + esac + done + + printf "\nConfirm send all log messages to server '$SYSLOG_SERVER_IP' on port '$SYSLOG_SERVER_PORT' using protocol '$SYSLOG_SERVER_PROTOCOL' (Y/N)" + read + case $REPLY in + Y|y) + ovirt_rsyslog $SYSLOG_SERVER_IP $SYSLOG_SERVER_PORT $SYSLOG_SERVER_PROTOCOL + break + ;; + N|n) + printf "\nDiscarding settings" + break + ;; + esac + else + printf "\nInvalid port number" + fi + done + +} + +prompt_user + +exit 0 -- 1.5.6.5