Log File Text Search

Version 1

    This Log File monitor can check for a search string in a log file that contains a date stamp.

    There are two features of this template that improve on other File Text Monitoring templates.

    1.    This template can handle date stamps in the file name like…”ErrorLog-08_23_2010.txt”. You can use the ${Date} variable anywhere in the filename to substitute in the current date in the file name…“ErrorLog-${Date}.txt”. You can use any combination of yy, yyyy, m, mm, d, and dd. You can use separators like -, ., _, and /.

    2.    This template can also handle multiple hits of the search string in a file. Previous File Text Monitoring templates alert when the first hit on a search comes up, and then that alert stays there until the text is gone (When the text file is replaced at the next day). This means if the error occurs at 1am the alert stays there all day long, and if a second error occurs during the day you will not get alerted.
    This monitor actually counts how many times a search string is hit, and alerts if new hits occur. The component will go critical at the first hit, and then go warning at the next check. The warning just indicates the search string was hit sometime that day. If a new hit on the search happens, the component will go critical again, and then go back to warning again on the next check.
    I also record how many times the search has hit in the one log file with the statistic field. It will increment by 1 every time the search hits, and clear back to 0 the next day.

    One other feature is the FailIf option. You can just change strFailIf = “found” to strFailIf = “notfound” if you want the component to go critical if the search is not found.

    A full list of all 4 variants and their usage is located in the Description of the Template, as well as at the top of the Script Body.