Splunk Search

Percentage of two values

splunkcol
Builder

Hi

I have a field called STATUS with 2 possible values ​​"SUCCESS" or "WARNING" but the percentages don't seem to work well, I appreciate suggestions

splunkcol_1-1631197644130.png

 

index=my_index SERVICE_CODE="ABCD"
|fields STATUS, SERVICE_CODE
| timechart span=1d sum(eval(if(STATUS="SUCCESS",1,0))) as SUCCESS, sum(eval(if(STATUS="WARNING",1,0))) as FAILED, count as total
| eval percentage=round((SUCCESS/total)*100,2)
| fillnull value=0
| fields percentage
| appendpipe
[stats count
| where count=0]

 

 

Labels (3)
0 Karma
1 Solution

splunkcol
Builder

I think I have already solved it

For SUCCESS

splunkcol_0-1631199335340.png

For FAILED

 

splunkcol_1-1631199405730.png

 

View solution in original post

0 Karma

splunkcol
Builder

I think I have already solved it

For SUCCESS

splunkcol_0-1631199335340.png

For FAILED

 

splunkcol_1-1631199405730.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eval percentage=floor((SUCCESS/total)*10000)/100
Get Updates on the Splunk Community!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...