Monitor File Contents Step

This step monitors files for a token. The step will complete successfully when the token appears, but will fail if it is not found within the time specified.

Required properties:

Property Name Description
Files

Specify a new-line-separated list of paths to the files to monitor, relative to the current working directory.

Pattern Matching Rules:

* matches zero or more characters

? matches one character

** matches zero or more directories

Examples:

*.java - matches .java, x.java, and FooBar.java

?.java - matches x.java, A.java

**/*.txt - matches all txt files recursively

**/CVS/* - matches all files in CVS directories anywhere in the directory tree

org/apache/jakarta/** - matches all files in the org/apache/jakarta directory tree

org/apache/**/CVS/* - matches all files in CVS directories anywhere in the in the directory tree under org/apache/

**/test/** - matches all files that have a test element in their path, including test as a filename

Regular Expressions Specify a new-line-separated list of Java regular expressions to match a line in the files to be monitored.

. Any character

\d A digit: [0-9]

\D A non-digit: [^0-9]

\s A whitespace character: [\t\n\x0B\f\r]

\S A non-whitespace character: [^\s]

\w A word character: [a-zA-Z_0-9]

\W A non-word character: [^\w]

\\ The backslash character

[abc] a, b, or c

[^abc] Any character except a, b, or c (negation)

[a-zA-Z] a through z or A through Z, inclusive (range)

^ The beginning of a line

$ The end of a line

X? X, once or not at all

X* X, zero or more times

X+ X, one or more times

X{n} X, exactly n times

X{n,} X, at least n times

X{n,m} X, at least n but not more than m times

Examples:

a*b - matches b, aaaaab

a+b - matches ab, aaaaab

a.c - matches aac, aSc, a5c

a.?c - matches ac, abc

[A-Z]am - matches Jam, Sam

\d{3}-\d{2}-\d{2} - matches 123-56-78

Timeout Specify the time in seconds to wait for the regular expression match. The step will fail If a match is not found in that time.

Optional properties:

Property Name Description
Directory Offset A sub-directory of the current working directory where the step is to execute
Monitor from Tail

Select this to start monitoring from the ends of the files. One example use for this is when there is a growing log file and the token would appear later in the file.

Fail If Found Check here for the step to fail if it meets the criteria set in the regular expression. In this case the step will not fail after the timeout expires.