Bookmark this page

Guided Exercise: Finding Log Entries

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.

  1. Configure rsyslog on serverX to log all messages with severity debug in the 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.

    1. 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
    2. Restart the rsyslog service on serverX.

      [root@serverX ~]# systemctl restart rsyslog
  2. 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.

    1. Monitor the /var/log/messages-debug with the tail command on serverX.

      [root@serverX ~]# tail -f /var/log/messages-debug
    2. 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"
    3. 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
      
Revision: rh199-7-d0984a3