Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example

Download (upload .json):js7_checklog pduCheckLog.workflow.json 

This sample workflow includes the following jobs:

  • create-log: creates log output.
  • check-log: analyzes log output of the previous job.
  • display-result: displays the outcome of log analysis.

Image RemovedImage Added


To create the check-log job, users can invoke the job wizzard like this.:

Image RemovedImage Added


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:

Image RemovedImage Added


Explanation:

  • From the list of available job templates select the CheckLogJob.

Then hit the Next button to make the job wizard display available arguments:

Image RemovedImage Added


When hitting the Submit button the wizard adds the required arguments to the job which should look like this:

Image RemovedImage Added

Documentation

The Job Documentation including the full list of arguments can be found from: https://www.sos-berlin.com/doc/JS7-JITL/CheckLogJob.xml

Authentication

The Job makes use of the JS7 - REST Web Service API that is available from JOC Cockpit. 

  • The job is executed with an Agent and requires a network connection to JOC Cockpit.
  • The job has to authenticate with JOC Cockpit, for the related configuration see JS7 - JITL Common Authentication.

Arguments

The CheckLogJob class accepts the following arguments:

...

NameRequiredDescriptionDefault

job

yes

Job in the current workflow for which log output should be analyzed

If the job occurs more than once in the workflow, the label argument must be specified.


label

no

Label of the job for which log output should be analyzed

If the job occurs more than once in the workflow, the label argument must be specified to identify the unique occurrence of the job..


pattern

yes

Regular expression used to analyze the log

The regular expression is applied to log output of the job.


Exampe 1: Identify lines with errors

Arguments:

pattern = ".*error.*"
log = "One line with error" + "\r\n" + "Line without the word" + "\r\n" + "And one line with error in the middle";

Return Variables:

  • js7CheckLogMatches: One line with error|And one line with error in the middle
  • js7CheckLogMatchedGroups:
  • js7CheckLogMatchCount: 2
  • js7CheckLogGroupCount: 0
  • js7CheckLogGroupsMatchesCount: 0


Example 2: Identify Event IDs

Arguments:

pattern = "event:\d{3}";
log = "The first line with event:1234" + "\r\n" + "Line without event" + "\r\n" + "And one line with event:456 and event:555 in the middle";

Return Variables:

  • js7CheckLogMatches: event:123|event:456|event:555
  • js7CheckLogMatchedGroups:
  • js7CheckLogMatchCount: 3
  • js7CheckLogGroupCount: 0
  • js7CheckLogGroupsMatchesCount: 0


Example 3: Identify dates

Arguments:

pattern = "\d{1,2}.\d{1,2}.\d{4}";
log = "1.2.2002: first line" + "\r\n" + "04.1.1888: second line" + "\r\n" + "22.11.2001: third line";

Return Variables:

  • js7CheckLogMatchedGroups:
  • js7CheckLogMatches: 1.2.2002|04.1.1888|22.11.2001
  • js7CheckLogMatchedGroups:
  • js7CheckLogMatchCount: 3
  • js7CheckLogGroupCount: 0
  • js7CheckLogGroupsMatchesCount: 0


Example 4: Identify dates

Arguments:

pattern = "(\d{1,2}.\d{1,2}.\d{4}).(.*)$";
log = "1.2.2002: first line" + "\r\n" + "04.1.1888: second line" + "\r\n" + "22.11.2001: third line";

Return Variables:

  • js7CheckLogMatches: 1.2.2002: first line|04.1.1888: second line|22.11.2001: third line
  • js7CheckLogMatchedGroups: 1.2.2002|04.1.1888|22.11.2001
  • js7CheckLogMatchCount: 3
  • js7CheckLogGroupCount: 0
  • js7CheckLogGroupsMatchesCount: 6


separator

no

Separator for matches

Executing the regular expression on log output can result in several matches that are returned from the js7CheckLogMatches or js7CheckLogMatchedGroups variables. Matches are separated from each other by the separator character. By default the pipe character | is used.

|
timeout

no

Maximum duration to read task history

When the CheckLogJob job is executed, the JOC Cockpit History may not yet have been added related results of the job execution to be analyzed.

Repeated calls are performed with a delay of 3s until a call is successful or the maximum duration specified for the timeout is reached whichever occurs first.

15
multiline

no

Handling log output as one line or as multiple lines

Enables multiline mode in which the expressions ^ and $ match just after or before, respectively, a line terminator or the end of the input sequence.

By default the expressions match the beginning and the end of the entire input sequence. Multiline mode can be enabled by the embedded flag expression (?m) too.

false
case_insensitive

no

Handling of uppercase/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 combination with this flag. Case-insensitive matching can be enabled via the embedded flag expression (?i) too. Specifying the flag may impose slight performance penalties.

false

unix_lines

no

Handling of line mode

This flag enables Unix line mode in which '\n' is used as a line terminator and ‘\r’ is treated as a literal character.

false

Return Values

The return code of the job is 0 if the pattern matches and otherwise is 1.

...