How to read the powershell output from a variable like below which is not properly formatted.
Sample:
> $description
Alert: KNA Application error rate is high
<p style="box-sizing:borde
r-box;"></p><p style="box-sizing:border-box;">Alert ID: 68191403bc3b3bff7e9e9dc32e755dfcaf585979</p><p style="box-
sizing:border-box;">Source: LogAnalytics</p><p style="box-sizing:border-box;">Qu
ery: let window = 15m; let threshhold = 85; union workspace('df8524f4-72d6-48bf-bb6e-60320621d1ec').CF_HttpStartStop_CL,workspace('1d5cd2c8-8461-430
0-b5c0-b50eaa69b0ab').CF_HttpStartStop_CL,workspace('e65f915e-d3c4-471b-89eb-3613cd1f3c54').CF_HttpStartStop_CL,workspace('998825ae-9217-45f0-9bcd-60240936a734').CF_HttpS
tartStop_CL,workspace('ff3815e3-d9ab-43c4-ac7f-f7cf82a67acc').CF_HttpStartStop_CL,workspace('70d40933-9fb1-4afe-9c05-3d142430c105').CF_HttpStartStop_CL,workspace('df8524f
4-72d6-48bf-bb6e-60320621d1ec').CF_HttpStartStop_CL,workspace('1d5cd2c8-8461-4300-b5c0-b50eaa69b0ab').CF_HttpStartStop_CL | where TimeGenerated >= ago(window) | where
ApplicationName_s == 'alliance-platform-notifications-prod' or ApplicationName_s == 'alliance-platform-notifications-New' | extend statuscode_s=tostring(toint(StatusCode_
d)) | summarize rate=(countif(statuscode_s == '200' or statuscode_s == '404' or statuscode_s == '401')*100)/count() by ApplicationName_s, Environment_s | where rate <=
threshhold | project Resource=strcat('Error rate is high in application', ' - ',ApplicationName_s,' - ',' | In Region',' - ',Environment_s)</p><p style="box-sizing:borde
r-box;">AlertSeverity: SEV C</p><p style="box-sizing:border-box;">MonitorConditi
on: AlertFramework</p><p style="box-sizing:border-box;">QueryResponse:</p><table style="box-sizing:border-box;
border-collapse:collapse;border-spacing:0px;margin:0px;">Resou
rceError rate is high in application - alliance-platform-notifications-prod - | In Region
- krError rate is high in application - alliance-platform-notifications-prod - | In Region
- eu<p style="box-sizing:border-box;">Resource: Error rate is high in application - all
iance-platform-notifications-prod - | In Region - eu</p><br>
Please edit your already existing post - do not create a new one.
And you may share the code you used to produce this output. It may help answering your question. Most of the time it is better to create the output you’re after the way ou want it in the first place.
Please edit your already existing post – do not create a new one.
And you may share the code you used to produce this output. It may help answering your question. Most of the time it is better to create the output you’re after the way ou want it in the first place.
Thanks in advance.
[/quote]
The above is not a code .That is the output stored in a variable.I just wanted to know how to select some text /line from that variable.
This depends on how you are populating the variable. The variable appears to be HTML, so there are ways to populate and parse that with HTML DOM. Post the code that is populating the variable.