I am trying to achieve below requirement 1- Calculate the error rate label for multiple application if Error Rate greater than50%, mark "DOWN" in red; if Error Rate > 5% & <50%, mark "ISSUE" in Orange; else "UP" in Green. 2- After label column done then needs to create new widget with single value and check the all the labels (DOWN, ISSUE, UP) if any (at least one) APIs in Error Rate is "DOWN", show "DOWN" in red; If any APIs in Error Rate is "ISSUE", show "ISSUE" in orange; else "UP" in green. Note- I need single text value result This is code i wrote till now but still not able to fullfill my requirement
<panel>
<single>
<title>Error Rate</title>
<search>
<query> app_name-abc OR app_name=xyz | rex field msg "\"[^\"]*\"\s(?<status>\d+)" | stats count(eval(status>-200 AND status<-300)) as pass count, count(eval(status>-400)) as fail_count by cf_app_name
| eval error rate (fail_count/ (pass_count + fail_count)) 100 | eval label if (error rate > 50, "DOWN", if(error_rate > 5, "ISSUE", "UP")) | eval error rate round(error_rate, 2) "X" rename error_rate AS "Error_rate(percent)" | stats count(eval(label="DOWN")) as down_count, count(eval (label-"ISSUE")) as issue count, count(eval (label-"UP")) as up_count | rangemap field-issue_count low-0-0 high-2-99 default-low | eval Status-case(down_count >-1, "DOWN", down_count=0 AND issue_count>-1, "ISSUE", 1--1, "UP") </query>
<sampleRatio>1</sampleRatio>
</search>
<option name="drilldown">none</option>
<option name="field">Status</option>
<option name="rangeValues">ISSUE, UP</option> <option name="rangeColors">orange, green</option>
<option name="drilldown">none</option>
<option name="field"> Status</option>
<option name="drilldown">none</option>
</single>
</panel>
... View more