Log Parser (Perl)

The Log Parser template allows you to check a specified log file and determine the total number of lines that match your search criteria.


Prerequisites: Perl must be installed on the target server.

Credentials: Root on target server.


Note: You must specify the correct arguments for each monitored component in the Script Arguments field. If you fail to do this, the monitor will return with a status error of "Undefined."


Components Monitors with Examples

Total Number of Strings Found

This monitor shows the total number of strings that match the search criteria in the entire log file. Additionally, in the message field, this monitor returns all strings that match search criteria. In the returning message, this component returns all lines that match the search criteria divided by ";"

       This monitor uses the following arguments:
      perl ${SCRIPT} LogFilePath RegularExpression
     
where
      LogFilePath -
This is the path of the target log file on the target server. The path can contain spaces.
      RegularExpression -
This is used for regular expression searches to find a desired string in the log file. Searches are case sensitive and can contain spaces.

      Below is an example using the Command Line field:
      perl ${SCRIPT} "/etc/inittab" "init"

Number of Newly Found Strings

This monitor shows the number of newly found strings after the last script execution. Additionally in message field this monitor returns all strings that matches search criteria. In the returning message, this component returns all lines that match the search criteria divided by ";"

      This monitor uses the following arguments:
     perl ${SCRIPT} LogFilePath RegularExpression
     
where
      LogFilePath -
This is the path of the target log file on the target server. The path can contain spaces.
      RegularExpression -
This is used for regular expression searches to find a desired string in the log file. Searches are case sensitive and can contain spaces.

     Below is an example using the Command Line field:
     perl ${SCRIPT} "/etc/inittab" "init"

Found String in # Position

     This monitor shows the number position of the string found from the end that matches the search criteria, as well as the string itself. By default, this counter also shows the last string.

     This monitor uses the following arguments:
     perl ${SCRIPT} LogFilePath RegularExpression
     
where
      LogFilePath -
This is the path of the target log file on the target server. The path can contain spaces.
      RegularExpression -
This is used for regular expression searches to find a desired string in the log file. Searches are case sensitive and can contain spaces.
     Position - This value determines the position from the last string of the log file. By default value 1 will return last found string.

    

     Below is an example using the Command Line field. The Position argument is employed as “1”.
     perl ${SCRIPT} "/etc/inittab" "init" "1"

Parents Comment Children
No Data