From fc58a8e87281f1f2400bcfad0b865f3801a80caa Mon Sep 17 00:00:00 2001 From: Sebastian Thorarensen Date: Thu, 11 Jan 2018 04:00:59 +0100 Subject: [PATCH] Do not comment out rsyslog /var/log/messages on MN (#4527) Since commit 1219fdd23fb8602bb1029b96bb69cf4d746f0029, the rsyslog rule "*.debug /var/log/messages" is no longer added to rsyslog.conf on the MN. However, any rule ending with "/var/log/messages" is still commented out. This leads to xCAT removing all output to /var/log/messages, except for the daemon and ftp facilities that are enabled by /etc/rsyslog.d/xcat-debug.conf! This commit - stops commenting out rules ending with "/var/log/messages" in rsyslog.conf - stops adding adding the comment "#*.debug /var/log/messages" to rsyslog.conf - changes "daemon.debug" to "daemon.=debug" in xcat-debug.conf to avoid duplicate daemon log lines with most Linux distributions' default rsyslog.conf. The 'ftp.* rule in xcat-debug.conf is possibly no longer needed, and will lead to duplicate ftp messages with most distributions, but it is left untouched in this commit. --- xCAT/etc/rsyslog.d/xcat-debug.conf | 6 +++--- xCAT/postscripts/syslog | 12 ++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/xCAT/etc/rsyslog.d/xcat-debug.conf b/xCAT/etc/rsyslog.d/xcat-debug.conf index 4756b300d..555edf8e9 100644 --- a/xCAT/etc/rsyslog.d/xcat-debug.conf +++ b/xCAT/etc/rsyslog.d/xcat-debug.conf @@ -1,3 +1,3 @@ -# By default, dhcpd use the ``daemon'' facility. Thus dhcp logs will go here. -# ftp.* is for tftp log. -daemon.debug;ftp.* /var/log/messages +# Make sure dhcpd requests and responses (daemon.=debug) and +# tftp messages (ftp.*) are logged. +daemon.=debug;ftp.* /var/log/messages diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index e8286121f..6e5036dd7 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -117,11 +117,8 @@ config_Rsyslog_C3() #enable to send the logging to master if [ $isLocal -eq 1 ]; then - #enable the MN to log all the logs from CN and MN itself - sed -i 's/\(^[^\#].*\/var\/log\/messages\)/\#\1/g' $2 - echo "#*.debug /var/log/messages" >> $2 - touch /var/log/messages if ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then + touch /var/log/messages chown syslog:adm /var/log/messages sed -i 's/\$PrivDropToGroup syslog/\$PrivDropToGroup adm/' $2 chown syslog:adm /var/log/xcat @@ -200,7 +197,7 @@ config_rsyslog_V8() if [ $goLocal -eq 1 ]; then #logging is local, do not forward - #making sure all the messages goes to /var/log/messages + #making sure /var/log/messages is setup for xcat-debug touch /var/log/messages if ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then chown syslog:adm /var/log/messages @@ -208,14 +205,9 @@ config_rsyslog_V8() chown syslog:adm /var/log/xcat fi - #comment out the rules which will write logs to /var/log/messages - # to prevent duplicate logs after "syslog" script is run - sed -i '/^[^#].*\/var\/log\/messages/s/^/#/' $conf_file - # Mark the start of xCAT section echo "# $xCATSettingsSTART" >> $conf_file echo "# $xCATSettingsInfo" >> $conf_file - echo "#*.debug /var/log/messages" >> $conf_file # Need to uncomment the lines $ModLoad imudp.so and $UDPServerRun 514, # to make the MN be able to receive syslog from remote hosts if [ -f "$remoteconf" ]; then