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, or higher, for any service into a newly created log file /var/log/messages-debug by 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-debug log file.
Change the rsyslog configuration to log all messages with severity debug to /var/log/messages-debug on serverX by adding the /etc/rsyslog.d/debug.conf file.
[root@serverX ~]#echo "*.debug /var/log/messages-debug" >/etc/rsyslog.d/debug.conf
Restart 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-debug with the tail command on serverX.
Monitor the /var/log/messages-debug with the tail command on serverX.
[root@serverX ~]#tail -f /var/log/messages-debug
On 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