Dashboards & Visualizations

How do I calculate HTTP failure Percentage?

Abdullaziz19
Engager

Dear community, I have this:

index=*** sourcetype="*********** " Path=*******"
| stats count by HTTPStatusCode. which will display codes 2**,4**, 5**

Percentage fail0.PNGPercentage fail0.PNG

then I used this code to calculate the failure rate 

index=***** sourcetype="*****" Path="*****"
| stats count AS Total count(eval(HTTPStatusCode="200")) as Success
| eval Failure = Total - Success | eval Percent_Failure = round((Failure/Total)*100)."%"
| stats count by Percent_Failure 

Percentage fail.PNGPercentage fail.PNG

as you can see above it worked fine showing 2% fail rate. so  I added it to my "Classic Dashboard" as a SingleValue and all is good.  but, to my frustration, when add it to my new Dashboard Studio. it shows this :

singleValue :

Percentage fail3.PNGPercentage fail3.PNG

but when change it to table type:

Percentage fail2.PNGPercentage fail2.PNG

as you can see the logic is correct and it working fine. but why is it refusing to work as singlevalue in the 

new dash studio? is it compatibility issue in the new studio? my goal is to is just to display a nice percentage of failures. I need your help please I am new to splunk  

 

thanks,

 

 

 

Labels (2)
0 Karma
1 Solution

danspav
SplunkTrust
SplunkTrust

Hi @Abdullaziz19,

Your table is returning two fields: Percent_Failure, and count.

You can make the singe value viz use the "Percent_Failure" field by selecting the following under the "Selected Data Field" option:

danspav_0-1685928253744.pngdanspav_0-1685928253744.png

That way you're specifying the right value to use.

Note that you can also add the "%" character in the dashboard options too - just calculate the numeric value you want to display and set the Unit Label to "%". That way you can also round the number automatically, and set thresholds based on its value.

danspav_1-1685928377424.pngdanspav_1-1685928377424.png

Cheers,

Daniel

 

 

 

View solution in original post

0 Karma

danspav
SplunkTrust
SplunkTrust

Hi @Abdullaziz19,

Your table is returning two fields: Percent_Failure, and count.

You can make the singe value viz use the "Percent_Failure" field by selecting the following under the "Selected Data Field" option:

danspav_0-1685928253744.pngdanspav_0-1685928253744.png

That way you're specifying the right value to use.

Note that you can also add the "%" character in the dashboard options too - just calculate the numeric value you want to display and set the Unit Label to "%". That way you can also round the number automatically, and set thresholds based on its value.

danspav_1-1685928377424.pngdanspav_1-1685928377424.png

Cheers,

Daniel

 

 

 

0 Karma

Abdullaziz19
Engager

I followed your steps and it worked like a charm thanks a lot man.

Abdullaziz19_0-1685957553149.pngAbdullaziz19_0-1685957553149.png

 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...