Process Definitions: File Searches Tab
File searches let you easily search for errors or warnings in log files and set the status of the process accordingly. You can use a file search to parse output and log files for a specific string pattern, then force the process to a specific status when the file matches the pattern. You can also store the matched string (or some part of it) in an Out parameter.
Field | Description |
---|---|
Processing Order | Sequence number for this file search. File searches are performed in sequence based on their Processing Order values, until a file search is matched that has the Stop property checked or the last file search has been performed. |
Stop | Specifies a file search that will prevent any further file searches to be performed if matched. |
Process Note | Lets you add a note to the process with the result of the file search. |
File | The name of the file to search for. You can use glob matching. |
Search Pattern | The pattern to search for in the file. If Wild Card is checked, you can use glob matching. |
Begin Line | The line at which to begin the search. Use -1 and check Reverse to start from the end of the file. |
End Line | The line after which to stop the search. If Reverse is checked, lines are counted from the end of the file. Specify -1 to end the search at the last line. |
Return Code | The return code to assign to the matching process (if any). |
New Process Status | The status to assign to the matching process. |
Entire Line | If this is checked, the pattern must match the entire line, not just a substring of the line. |
Ignore Case | If this is checked, the search is case-insensitive. |
Reverse | Check this box to initiate the search from the end of the file. |
Wild Card | Allow the use of glob matching in Search Pattern. |
Output Definition Parameter | The Out parameter to use to store the matched line. |
Out Param Expr | REL expression for the Out parameter value. The built-in variable line contains the string of the line matching the search criteria. |
If the Process Definition is using the file search feature, and there is also a Post Running action configured on the Actions tab and/or a trigger has been created using the Before Process Post Running trigger option in the Scripting > Triggers module, the file search is executed first. In the case when all three options are configured, they are executed in the order listed below.
- File search
- Before Process Post Running Trigger
- Post Running Action
Example
Assume you have a process that does not always return a return code greater than 0
when errors occur, and you want RunMyJobs to look for a specific error message in the log. Assume you want to create a note indicating the error and store the matched line in the Out parameter P_Error_Code
so you can quickly see what the error was. The process in question runs a PL/SQL script, and you want to detect Oracle ORA-12345
errors.
- Navigate to Definitions > Processes.
- Select Edit from the context menu of the Process Definition in question.
- On the File Searches tab, click Add.
- Enter the data from the following table into the fields, then click Save & Close.
Field | Value |
---|---|
Processing Order | 0
|
Stop | Checked |
Note | Checked |
File | stderr.log
|
Search Pattern | ORA-*
|
Begin Line | 1
|
End Line | -1
|
Return Code | 1
|
New Status | Error |
Entire Line | Checked |
Ignore Case |
Unchecked |
Reverse |
Unchecked |
Wild Card | Checked |
Output Definition Parameter | P_Error_Code
|
Out Parameter Expression | =line.substring(12)
|