Searching Files
You use File Searches to parse output and log files for a specific string pattern. You can force the process to a specific status when the file matches the pattern, you can also store the matched string in an Out parameter, or a part of it.
Field | Description |
---|---|
Processing Order | File searches are performed in sequence, following the processing order, until one is matched that has the Stop property checked or the last file search has been performed. |
Stop | Specifies a file searcher that will prevent any file searches to be performed if matched. |
Note | Add a note with the result of the file search. |
File | The name of the file to search through, you can use GLOB wildcards * and ? :<br/ >* - zero or more characters? - exactly one character |
Search Pattern | The pattern that the searcher is looking for in the file, you can use GLOB wildcards * and ? when Wild Card is enabled (see below):<br/ >* - zero or more characters? - exactly one character |
Begin Line | Line at which to begin the search, use -1 to start from the end of the file, with the Reverse property set. |
End Line | Line after which to stop, if the Reverse property is set, lines are counted from the end of the file. You specify -1 (default) which is evaluated as end of file. |
Return Code | The return code to give to the process if the pattern matched. |
New Process Status | The status to give to the process if the pattern matched. |
Entire Line | Pattern must match entire line, not just a substring of it. |
Ignore Case | Case insensitive search for Search Pattern. |
Reverse | Start for Search Pattern from the end of the file. |
Wild Card | Allow the use of GLOB wild cards in Search Pattern (see above). |
Output 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. |
Execution
In previous versions, many customers were using post running actions to search for errors or warnings in log files and set the status of the process. In version 9, file searches were introduced to allow you to easily create such post running actions.
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
You have a process that does not always return a return code above 0
when errors occur and you would still like Redwood Server to pick up a specific error message in the log.
You would like to create a note with the error as well as 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 should 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, choose Add.
- Fill the data of the following table into the fields, choose Save & Close.
Field | Value |
---|---|
Processing Order | 0 |
Stop | x |
Note | x |
File | stderr.log |
Search Pattern | ORA-* |
Begin Line | 1 |
End Line | -1 |
Return Code | 1 |
New Status | Error |
Entire Line | x |
Ignore Case | |
Reverse | |
Wild Card | x |
Output Definition Parameter | P_Error_Code |
Out Parameter Expression | =line.substring(12) |
See Also
JobChain JobDefinition ProcessDefinition FileSearch JobFileSearch