Hi Everyone,
I'm trying to parse the alert content in the APM XML policy in order to enrich the alert, but am struggling to retrieve the content of the variable.
Use case:
Alert Summary contains a string like "embeddor |back|WASBACKPVLSK00| ** Failing embeddor checks pdbacka00 |http//WASBACKPVLSK00.santanderuk.corp7307/BDPABB_ENS/Embeddor:is now failing violated threshold".
I'd like to be able to extract the third field separated by pipe, so in this example it would be "WASBACKPVLSK00". Then I need to assign the value of split_server variable to a userAttribute.
Results:
I have tried using both RegExs shown in the Parse section of the code extract below, but neither of them populate userAttribute7 with anything at all (not even just the "09:20" string) - I commented that line out and tried with a simple literal string in the next line and that works fine.
I am now stuck and would appreciate any guidance that can be provided.
APM EventClass code:
<EventClass name="Embeddor_Alerts" extends="Alert">
<Parse>
<Field input="Summary" pattern="([^\|]*)\|([^\|]*)\|([^\|]*)" output="split_emb,split_cell,split_server" />
<!-- Field input="Summary" pattern="^(.*)\|(.*)\|(.*)\|" output="split_emb,split_cell,split_server" / -->
</Parse>
<Format>
<!-- Build the Generic helpfile URL for embeddors -->
<Field output="userAttribute3" format="http://alerthub.unix.santanderuk.corp/help/wily/Embeddor/embed" input="" />
<Field output="userAttribute5" format="APM_Alert_ComputerSystem" input="" />
<Field output="userAttribute6" format="Polled" input="" />
<Field output="userAttribute9" format="APM (Introscope)" input="" />
<Field output="userAttribute2" format="{0}" input="UrlParams" />
<Field output="Message" format="<b>Hostname: </b>{0} <b><br/>Problem: </b>{1} <br/>{2} <br/><br/><a href="{3}"><b><u>Click here for Ops instructions</b></u></a> <br/><br/><a href="{4}"><b><u>APM Console</b></u></a><br/>" input="AlertedMdrElementID,userAttribute9,Summary,userAttribute3,UrlParams" />
<!-- Field conditional="split_server" output="userAttribute7" format="09:20 {0}" input="split_server" / -->
<Field output="userAttribute7" format="10:00 {0}" input="test" />
</Format>
<Write>
<Field type="publishcache" properties="*"/>
</Write>
</EventClass>
Many thanks
Chris