Example: Monitoring a remote log file

In this example, you add a log file to a database server. With the log file added, you can then monitor that file when you run a test.

About this task

To monitor a remote log file over SSH:

Procedure

  1. Add an identity to authenticate to a remote host over SSH. From the Physical view, click General > Identity.
    Identity dialog
  2. Now, set the SSH connection on the server that you want to monitor. From the Connectivity tab, double-click the Identity field for the ssh connection and select the identity. Enter the port number for the connection. The default is 22. To verify that the connection works, click Test Connection.
    Add connectivity dialog
  3. Next, add a log file to monitor the database. From the Logical view, double-click the database and select the Monitoring tab. Under the Location tab, enter the path to the location where the log files for this server are stored and use a wildcard match for the log file (*.log) for the name of the log file to monitor.
    Add log file location dialog
  4. Finally, define a test action that looks for the word error and if found, flags the entry in the console and fails the test.
    1. Click the Log file list to select the file match.
    2. Click the Actions tab and add the text to match and the action to take.
      Action selection
    3. Double-click the Match field to open the regular expression matching window (Edit Regex).

      The selected file is searched by using Regex and matches are shown.

      Regex

      The monitoring configuration is shown.

      Add log file action dialog
  5. Run the test. If the test finds matching text, the entry is flagged in the console, and the test fails.

    Console output for test run

    For an example project to use, see this technote.