SLES12/rsyslog 8 support defect 4311

This commit is contained in:
lissav 2014-10-22 07:42:42 -04:00
parent b5f708ed39
commit 75f15ce9b7

View File

@ -114,6 +114,38 @@ config_Rsyslog_C3()
fi
}
# THis sets up rsyslog 8.x, quite different from the previous rsyslog versions.
config_rsyslog_V8()
{
isReceiving=0
remoteconf="/etc/rsyslog.d/remote.conf"
if [ -f /etc/xCATMN ] || [ $isSN -eq 1 ]
then
isReceiving=1
fi
if [ ! -f $remoteconf.XCATORIG ]; then
cp -f $remoteconf $remoteconf.XCATORIG
fi
# check if already an entry, we need to replace it
grep "xCAT settings" $remoteconf 2>&1 1> /dev/null
if [ $? -eq 0 ]; then
sed "/# xCAT settings/,$ d" $remoteconf >/tmp/sed.tmp
cat /tmp/sed.tmp >$remoteconf
fi
echo "# xCAT settings" >> $remoteconf
echo "*.* @$master" >> $remoteconf
restartservice syslog
}
#echo "NTYPE=$NTYPE,OSVER=$OSVER,OSTYPE=$OSTYPE"
if [ "$NTYPE" = service ]; then
@ -124,6 +156,20 @@ fi
# systemdEnabled=1
#fi
# check if this is rsyslog version 8, setup is different no matter what OS.
# We only update the /etc/rsyslog.d/remote.conf file to point to the xcatmaster.
# Do not even touch rsyslog.conf
# There is no /etc/sysconfig/rsyslog file, so we use rsyslogd -v to get the version
SYSLOGPROD=`rsyslogd -v | grep rsyslogd |awk {'print $1'}`
SYSLOGVER=`rsyslogd -v | grep rsyslogd |awk {'print $2'}`
if ( pmatch $SYSLOGPROD "*rsyslogd*" ) && ( pmatch $SYSLOGVER "8*" ); then
config_rsyslog_V8
#keep a record
logger -t xCAT -p local4.info "Install: rsyslog version 8 setup"
exit 0
fi
echo " not configuring $SYSLOGVER"
if [ "$(uname -s)" = "Linux" ]; then
if ( pmatch $OSVER "fedora*" ) || ( pmatch $OSVER "rhels5*" ) || ( pmatch $OSVER "rhel6*" ) || ( pmatch $OSVER "rhels6*" ) || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then
if [ -e /etc/rsyslog.conf ]; then
@ -158,13 +204,13 @@ fi
#handle sysconfig file to make remote loggling possible
#handle sysconfig file to make remote logging possible
if [ $isLinux -eq 1 ] && [ -e $sysconfig ]; then
if [ ! -f "$sysconfig.XCATORIG" ]; then
cp -f $sysconfig $sysconfig.XCATORIG
fi
#check if it is ryslog version 3, it has totally different settings in /etc/syslog.cong
#check if it is ryslog version 3, it has totally different settings in /etc/syslog.conf
if [ $isRsyslog -eq 1 ]; then
grep "SYSLOGD_OPTIONS" $sysconfig | grep -e "[\-c 3|\-c3|\-c4|\-c 4]" 2>&1 1> /dev/null
if [ $? -eq 0 ]; then