AnsweredAssumed Answered

Logmon - Define two variables in the same line (same Watcher)

Question asked by Sammeline on Jan 17, 2017
Latest reply on Jan 19, 2017 by Sammeline

Hi,

 

I'm trying to set up a Watcher Rule in logmon where I want to define to variables in a single line text file.

Excerpt from the file:

"<ID>1078</ID><Name>John</Name>"

 

I want the values 1078 and John as two separate variables.

I'm using the following expression:

/((?<=<ID>).*(?=</ID>))|((?<=<Name>).*(?=</Name>))/

 

In logmon the variables are set as Match Expression ($1 for ID and $2 for Name) in the same Watcher Rule.

The first capture group for <ID> and the second capture group for <Name>

Message To Send on Match: "Person ${Name} has ID ${ID}"

(desired result: "Person John has ID 1078")

 

When testing the profile I noticed that it won't match both <ID> and <Name>.

I get the following message: "Person ${Name} has ID 1078"

When changing the order of the elements in the file to "<Name>John</Name><ID>1078</ID>" I get "Person John has ID $ID".

So it looks like it only matches the first possible one. I have "Alarm on First Match Only" unchecked.

 

Is it possible to define two variables in the same Watcher Rule using a single line text file?

 

Any help is appreciated!

 

Thanks in advance,

Erik

Outcomes