Using RegEx in Variables for the Logmon probe
search cancel

Using RegEx in Variables for the Logmon probe

book

Article ID: 233742

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

I need to create a Logmon variable from a group captured using RegEx.

Environment

Release : UIM 20.3+

Component : UIM LOGMON

Cause

How to

Resolution

After creating a RegEx that matches your string with a group(s) captured, you can assign those groups to a variable for use in the Message or Suppression Key.

For example:

Your RegEx string is the following:

/.*String (\d*).*/

Comparing this RegEx to the following:

Test String 123456 Testing

The captured group is 123456.  The desired group is indicated by the () in the RegEx String.

You can create a variable for the watcher by right clicking in the Variable tab and selecting New.  This opens the following window where you will populate the Name field, select the 'Match Expression' source, and enter 1 into the position field.  The 1 indicates that this is the first captured group from the RegEx.  This value should be 2 if you are using the second captured group, and so forth.

After this variable has been saved, you can reference it in the other parts of the configuration by using the leading character $ and selecting the variable name: