Introduction
The JITL Check Log Job template can be used to check the log of an previously executed job in the workflow.
- Users would like to analyze log output of previously executed jobs.
- Analysis includes to identify warnings and errors.
- Analysis includes to identify output for decision-making about next steps in a workflow.
The job template makes use of the JS7 - REST Web Service API to run reports from the JOC Cockpit.
- The job template authenticates with the JS7 - REST Web Service API with a user account/password and/or with a certificate, for details see JS7 - Authentication.
- For details about configuration items see JS7 - JITL Common Authentication.
FEATURE AVAILABILITY STARTING FROM RELEASE 2.7.2
Usage
When defining the job either:
- invoke the Wizard that is available from the Job Properties tab in the Configuration view and select the JITL CheckLogJob Template and relevant arguments
or
- specify the
JITL
job class andcom.sos.jitl.jobs.checklog.CheckLogJob
Java class name.
Example:
Download (upload .json) The workflow configuration can be downloaded from here: js7_checklog.workflow.json
This example workflow includes 3 jobs
- job1: Just producing a log.
- job2: Analysing the log
- job_result: Showing the outcome of job_checklog
To create the job job_checklog
you can use the job wizzard like this.
Explanation:
- Add an empty job from the instruction panel.
- Specify a name and a label for the job.
- Select an Agent.
In a next step invoke the job wizard that you find in the upper right corner of the job property editor. The wizard brings up the following popup window:
Explanation:
- From the list of available job templates select the CheckLogJob.
Then hit the Next button to make the job wizard display available arguments:
When hitting the Submit button the wizard adds the required arguments to the job which should look like this:
Documentation
The EncryptJob class accepts the following arguments:
Name | Description | Default |
---|---|---|
| The job in the current workflow whose log is to be analysed When the job occurs more than one time in the workflow, the parameter "label" must be specified | |
label | The label of the job whose log is to be analysed When the job occurs more than one time in the workflow, the parameter "label" must be specified to unique identify the job whose log is to be analysed. | |
pattern | The regular expression to be used to examine the log The regular expression is applied to the log. Exampe 1: get lines with errors pattern = ".*error.*"
| | |
separator | To separate the matched values Executing the regular expression on the log can result in several matches. The matches are returned in the variable js7CheckLogMatches or js7CheckLogMatchedGroups and separated from each other with ‘separator’. | |
multiline | Handling the log as one or multiple lines Enables multiline mode. In multiline mode the expressions ^ and $ matchjust after or just before, respectively, a line terminator or the end of the input sequence. By default these expressions only match at the beginning and the end of the entire input sequence. Multiline mode can also be enabled via the embedded flagexpression (?m). | |
case_insensitive | Handling of upper/lowercase Enables case-insensitive matching. By default, case-insensitive matching assumes that only characters in the US-ASCII charset are being matched. Unicode-aware case-insensitive matching can be enabled by specifying the UNICODE_CASE flag in conjunction with this flag. Case-insensitive matching can also be enabled via the embedded flag expression (?i). Specifying this flag may impose a slight performance penalty. | false |
unix_lines | Handling of line mode This flag enables Unix lines mode. In the Unix lines mode, only '\n' is used as a line terminator and ‘\r’ is treated as a literal character. | false |
Return Values
Name | Description |
---|---|
js7CheckLogMatchedGroups | Matching groups separated by the separator sign A string value holding the matching groups of the task log. An empty value is returned if the pattern doesn't not match In case of a pattern specifying capturing groups, the matching characters are provided for each group. The return variable holds values per group separated by the character specified from the separator argument. |
js7CheckLogMatches | Matches separated by the separator sign A string value holding the matching characters of the task log. An empty value is returned if the pattern doesn't not match The return variable holds values per match separated by the character specified from the separator argument. |
js7CheckLogMatchCount | Count of matches The count of matches |
js7CheckLogGroupsMatchesCount | Count of matches The count of matched groups. Depends on value for the parameter "multiline". multiline=false -- matched groups when the log is regarded as one line. multiline=true -- Sum of matched groups for each line. |
js7CheckLogGroupCount | Count of groups The number of groups in the pattern. |
Further Resources
- JS7 - JITL Common Variables
- JS7 - How to make a global Business Date variable available to jobs
- JS7 - How to update a Job Resource using Unix Shell