RHCSA Rapid Track
In this lab, you will reconfigure rsyslog to write specific messages to a new log file.
Outcomes
The rsyslog service writes all messages with priority debug to the /var/log/messages-debug log file for temporary troubleshooting purposes.
Configure rsyslog on serverX to log all messages with severity debug in the newly created log file
/var/log/messages-debugby adding the rsyslog configuration file/etc/rsyslog.d/debug.conf. Verify that a generated debug log message with the logger command arrives in the/var/log/messages-debuglog file.Change the rsyslog configuration to log all messages with severity debug to
/var/log/messages-debugon serverX by adding the/etc/rsyslog.d/debug.conffile.[root@serverX ~]#echo "*.debug /var/log/messages-debug" >/etc/rsyslog.d/debug.confRestart the rsyslog service on serverX.
[root@serverX ~]#systemctl restart rsyslog
Generate a debug log message with the logger command and verify that the message gets logged to the log file
/var/log/messages-debugwith the tail command on serverX.Monitor the
/var/log/messages-debugwith the tail command on serverX.[root@serverX ~]#tail -f /var/log/messages-debugOn a separate terminal window, use the logger command to generate a debug message on serverX.
[root@serverX ~]#logger -p user.debug "Debug Message Test"Switch back to the terminal still running the tail -f /var/log/messages-debug command and verify the message sent with the logger command shows up.
[root@serverX ~]#tail -f /var/log/messages-debug... Feb 13 10:37:44 localhost root: Debug Message Test