File: //opt/BCLinux/bse/secure_set/s18_syslogKern
#!/bin/sh
#=====================================================================
InsertSection "Recording the kernel warn..."
if [ $RECORDING_KERNEL_WARN -eq 1 ]; then
cp -np /etc/rsyslog.conf /etc/rsyslog.conf_bak
#--------------recording the kernel warring--------------
IS_EXIST=`egrep -v '^$|^#' /etc/rsyslog.conf | grep -E '^kern.warning' | grep "kern.warning \{1,\}\/var\/log\/.\{1,\}" | wc -l`
if [ "${IS_EXIST}" = "0" ] ; then
logtext "no kern.warn set, adding..."
echo " " >> /etc/rsyslog.conf
echo "kern.warning /var/log/${KERNEL_WARN_FILE_NAME}" >> /etc/rsyslog.conf
else
logtext "Has kern.warn set, passing..."
fi
# restart the syslog service
#systemctl restart rsyslog
Display --indent 2 --text "- Setting the rsyslog.conf, recording the kern warn... " --result FINISHED --color GREEN
else
Display --indent 2 --text "- Skip recording the kernel warn due to config file... " --result SKIPPING --color YELLOW
fi