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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...