Versions Compared

Key

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

...

The EncryptJob class accepts the following arguments:


NameDescriptionDefault

job
[required]    

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
[required if job occurs more than one time]    

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
[required]    

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.*"
log = "One line with error" + "\r\n" + "Line without the word" + "\r\n" + "And one line with error in the middle";
==> Result:

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

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


Example 3: Get all dates
pattern = "\d{1,2}.\d{1,2}.\d{4}";
log = "1.2.2002: first line" + "\r\n" + "04.0.1888: second line" + "\r\n" + "22.11.2001: third line";
==> Result:

  • js7CheckLogMatchedGroups:
  • js7CheckLogMatches: 1.1.2021|22.05.1996|1.04.1888
  • js7CheckLogMatchedGroups:
  • js7CheckLogMatchCount: 3
  • js7CheckLogGroupCount: 0
  • js7CheckLogGroupsMatchesCount:0


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

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

|

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


The returncode of the job is 0 when the pattern matches. Otherwise it is 1.


NameDescription
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

...