Documentation forServer & Application Monitor
Monitoring your applications and environment is a key capability of SolarWinds Observability Self-Hosted (formerly Hybrid Cloud Observability) and is available in the Essentials edition. Server & Application Monitor (SAM) is also available in a standalone module.

Log Parser (PowerShell)

Use this SAM application monitor template to monitor a specific log file and determine the total number of lines that match your search criteria.

Depending on how PowerShell is used, it can make your deployment vulnerable to unauthorized access. For details, see Use PowerShell in SAM.

Prerequisites

WinRM is installed and enabled on target servers.

PowerShell 5.1 is installed on target servers.

Credentials

Administrator rights are granted on target servers.

Specify the correct arguments for each monitored component in the Script Arguments field. Otherwise, the monitor will return with a status error of Undefined.

Component monitors

Total number of strings found

The total number of strings that match the search criteria. This monitor uses the following arguments:

  • LogFilePath,RegularExpression, where LogFilePath is the path of the target log file on the target server. The path cannot contain any spaces.
  • RegularExpression is used for RegEx searches to find a desired string in the log file. Searches are not case sensitive; however, a search cannot contain spaces.

The following Scripts Arguments example searches for strings that match the word error in the powertest.log file:
d:\powertest.log,^error

This monitor also returns strings that match search criteria, as shown in the Message field and separated by ";" characters.

Number of newly found strings

The number of new strings detected, as added after the last time this monitor polled for data. This component uses the following arguments:

  • LogFilePath,RegularExpression where LogFilePath is the path of the target log file on the target server. The path cannot contain any spaces.
  • RegularExpression is used by RegEx searches to find a desired string in the log file. Searches are not case sensitive; however, a search cannot contain spaces.

The following Scripts Arguments example searches for new strings that match the word "error" in the powertest.log file:
d:\powertest.log,^error

This monitor also returns strings that match search criteria, as shown in the Message field and separated by ";" characters.

Found String in # Position

The line number of the last match found in the file. This monitor uses the following arguments:

  • LogFilePath,RegularExpression,Position where LogFilePath is is the path of the target log file on the target server. The path cannot contain any spaces.
  • RegularExpression is used by RegEx searches to find a desired string in the log file. Searches are not case sensitive; however, a search cannot contain spaces.
  • Position determines the position from the last string of the log file. By default, a value of 1 will return the last string found.

For example, the following script argument searches for the last instance of the word "error" in a file and returns the line number: d:\powertest.log,^error,1