Versions Compared

Key

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

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

Introduction

The JITL Check Log Job CheckLogJob template can be used to check the log output of an a previously executed job in the workflow. 

...

  • 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.:

...

  • specify the JITL job class and com.sos.jitl.jobs.checklog.CheckLogJob Java class name.

Example

...

Download (upload .json) The workflow configuration can be downloaded from here: js7_checklogpduCheckLog.workflow.json 

This example sample workflow includes 3 the following jobs:

  • job1: Just producing a log.
  • job2: Analysing the log
  • job_result: Showing the outcome of job_checklog
  • create-log: creates log output.
  • check-log: analyzes log output of the previous job.
  • display-result: displays the outcome of log analysis.

Image AddedImage Removed


To create the job job_checklog you can use 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 EncryptJob class accepts the following arguments:


NameRequiredDescriptionDefault

job

[required]    

yes

Job

The job

in the current workflow

whose log is to be analysedWhen

for which log output should be analyzed

If the job occurs more than

one time

once in the workflow, the

parameter "

label

"

argument must be specified.


label
[required if job occurs more than one time]    

no

Label

The label

of the job

whose log is to be analysedWhen

for which log output should be analyzed

If the job occurs more than

one time

once in the workflow, the

parameter "

label

"

argument must be specified to identify the unique

identify

occurrence of the job

whose log is to be analysed

..


pattern
[required]    
The regular expression to be

yes

Regular expression used to

examine

analyze the log

The regular expression is applied to log output of the

log

job.


Exampe 1:

get

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";

==> Result

Return Variables:

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


Example 2

: get event ids with event###

: 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";

==> Result

Return Variables:

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


Example 3:

Get all

Identify dates

Arguments:

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

0

1.1888: second line" + "\r\n" + "22.11.2001: third line";

==> Result

Return Variables:

  • js7CheckLogMatchedGroups:
  • js7CheckLogMatches: 1.
1
  • 2.
2021
  • 2002|
22
  • 04.
05
  • 1.
1996
  • 1888|
1
  • 22.
04
  • 11.
1888
  • 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.

0

1.1888: second line" + "\r\n" + "22.11.2001: third line";

==> Result

Return Variables:

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


separator
separator

no

Separator for matches

To separate the matched values

Executing the regular expression on

the

log output can result in several matches

. The matches

that are returned

in

from the

variable

js7CheckLogMatches or js7CheckLogMatchedGroups

and

variables. Matches are separated from each other

with ‘separator’.multiline

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

Handling the log as one or

multiple lines

Enables multiline mode

. In multiline mode

in which the expressions ^ and $

matchjust

match just after or

just

before, respectively, a line terminator or the end of the input sequence.

By default

these

the expressions

only

match

at

the beginning and the end of the entire input sequence. Multiline mode can

also

be enabled

via

by the embedded

flagexpression

flag expression (?m) too.

false
case_insensitive

no

Handling of

upper

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

conjunction

combination with this flag. Case-insensitive matching can

also

be enabled via the embedded flag expression (?i) too. Specifying

this

the flag may impose

a

slight performance

penalty

penalties.

false

unix_lines

no

Handling of line mode

This flag enables Unix

lines mode. In the Unix lines mode, only

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

false

Return Values

The returncode return code of the job is 0 when if the pattern matches . Otherwise it and otherwise is 1.


NameDescription
js7CheckLogMatchedGroups

Matching groups separated by the separator signGroups

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 matchesMatches

The count number of matches from the task log.

js7CheckLogGroupsMatchesCount

Count of matchesmatched Groups

The count number of matched groups . Depends that depends on the value for the parameter "multiline". multiline=false -- matched groups when the log is regarded as one line. multiline=true -- Sum multiline argument:

  • false: Total of matched groups with the task log being considered a single line.
  • true: Total of matched groups for each line.
js7CheckLogGroupCount

Count of groupsGroups

The number of groups in the pattern.

...

Resources