Spectrum Event Procedure to match a sub string within an event attributes string value separated by a comma

book

Article ID: 194572

calendar_today

Updated On:

Products

CA Spectrum CA eHealth

Issue/Introduction

Spectrum Event Procedure to match a sub string within an event attributes string value separated by a comma.

For example, in the following evnt attribute string value:

clogHistMsgText = Interface TenGigE5001/0/0/2.1998, changed state to Up

We would like to have the sub-string "Interface TenGigE5001/0/0/2.1998" before the comma character to be set to another attribute of a new event to be created.

Environment

Release : Any

Component : Spectrum Events

Resolution

The following is an example of the regular expression to accomplish this task.

0xfff00001 E 0 A 3,0xfff00001

0xfff00000 P" \
CreateEventWithAttributes( \
{C CURRENT_MODEL}, \
{H 0xfff00001}, \
SetEventAttribute( \
GetEventAttributeList(), \
{U 100}, \
GetRegexp(GetEventAttribute( \
{U 1}), \
{S \"(.*), [^,]*\"}, \
{U 1})) \
)"

In the above example, the Regexp on event attribute 1 "{U 1}" looks for the comma and saves the information preceding the comma to event attribute 100.